-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix the cmd error that does not recognize wasmvm library version. #14
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #14 +/- ##
=======================================
Coverage 60.83% 60.83%
=======================================
Files 80 80
Lines 9879 9879
=======================================
Hits 6010 6010
Misses 3553 3553
Partials 316 316
|
@zemyblue |
I know. But without this test, the coverage ci is not satisfied. |
Okay! But If we really want to test this version sync, we can try like this func TestCheckLlibwasmVersion(t *testing.T) {
f, err := os.Open(filepath.Join(moduleBasePath(t), "go.mod"))
assert.NoError(t, err)
res, err := io.ReadAll(f)
assert.NoError(t, err)
parsed := strings.Split(string(res), "\n")
var expected string
for _, line := range parsed {
if strings.Contains(line, "github.com/line/wasmvm") {
expected = strings.Split(strings.TrimSpace(line), " ")[1]
}
}
got, err := wasmvm.LibwasmvmVersion()
assert.NoError(t, err)
assert.Contains(t, expected, got)
}
func moduleBasePath(t *testing.T) string {
t.Helper()
err := os.Setenv("GO111MODULE", "on")
if err != nil {
t.Fatalf("unable to set GO111MODULE env var: %v", err)
}
cmd := exec.Command("go", "list", "-f", "{{.Module.Dir}}")
out, err := cmd.Output()
if err != nil {
t.Fatalf("failed to evaluate Go module base path: %v", err)
}
return strings.TrimSpace(string(out))
} |
Description
closes: #13
fix the cmd error that does not recognize wasmvm library version.
Motivation and context
When we run the wasmd cli,
Error: wasmvm module not exist
is always displayed.How has this been tested?
Screenshots (if appropriate):
Checklist:
CHANGELOG.md
client/docs/swagger-ui/swagger.yaml