Skip to content
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

tests: add standalone tests module for testing generated Go code #166

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

ydnar
Copy link
Collaborator

@ydnar ydnar commented Sep 13, 2024

Implement a lightweight pattern for testing generated Go code using TinyGo + wasip2. In addition, the testdata directory now has an empty go.mod file to exclude it from module distribution.

  • Generated Go interfaces can be rebuild with make generate from the root directory.
  • To run tests, cd tests && tinygo test -v -target=./wasip2.json ./...

@ydnar ydnar self-assigned this Sep 13, 2024
@ydnar
Copy link
Collaborator Author

ydnar commented Sep 15, 2024

This requires TinyGo >= 0.33.1 to pass, which is not yet available.

.github/workflows/test.yaml Outdated Show resolved Hide resolved
@@ -0,0 +1,4 @@
{
"inherits": ["wasip2"],
"emulator": "wasmtime --wasm component-model -Sinherit-network -Sallow-ip-name-lookup --dir={tmpDir}::/tmp {}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For runtime tests that don't require networking, can we customize this JSON to suit specific test cases?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I submitted a PR to TinyGo to make this unnecessary.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ydnar ydnar force-pushed the ydnar/test-module branch 3 times, most recently from e289e39 to 0c9fe68 Compare September 24, 2024 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants