-
Notifications
You must be signed in to change notification settings - Fork 222
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
*: add e2e tests, replace "runner" with network-runner #82
Conversation
gyuho
commented
Apr 19, 2022
•
edited
Loading
edited
Signed-off-by: Gyuho Lee <gyuho.lee@avalabs.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, just one small thing
Signed-off-by: Gyuho Lee <gyuho.lee@avalabs.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I am not a coder but what if it looks like something techy, good luck with your hard work. |
scripts/run.sh
Outdated
if [ -z "${GENESIS_ADDRESS}" ]; then | ||
MODE=$2 | ||
if [[ -z "${MODE}" ]]; then | ||
echo "Missing version argument!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing mode argument?
tests/e2e/e2e_test.go
Outdated
"context" | ||
"flag" | ||
"fmt" | ||
"io/ioutil" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From https://pkg.go.dev/io/ioutil:
As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details.
Signed-off-by: Gyuho Lee <gyuho.lee@avalabs.org>
GOARCH=$(go env GOARCH) | ||
GOOS=$(go env GOOS) | ||
NETWORK_RUNNER_VERSION=1.0.11 | ||
DOWNLOAD_PATH=/tmp/avalanche-network-runner.tar.gz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use go install instead of downloading the avalanche network runner binary here? This should be possible now that we have removed the duktape hack.
tests/e2e/e2e_test.go
Outdated
}) | ||
}) | ||
|
||
func createDefaultCtx() (context.Context, context.CancelFunc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding a function like this obscures what is actually happening. Since this is a 1 liner anyways, can we just remove this in favor of creating a context with a 2 minute timeout wherever this is called to make it more clear what the default context is?
tests/e2e/e2e_test.go
Outdated
return os.WriteFile(p, ob, fsModeWrite) | ||
} | ||
|
||
func getVMID(vmName string) (ids.ID, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add this as a utility within AvalancheGo? We should probably use this as a standard practice to create our VMIDs instead of having a private helper function within this package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left as TODO, will add a util to avalanchego and import here in the following PR.
tests/e2e/e2e_test.go
Outdated
|
||
var _ = ginkgo.AfterSuite(func() { | ||
switch mode { | ||
case "test": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use constants for test
/ run
here?
Also, I don't think we should be relying on the test suite as the way to start a local network without shutting it down by passing in a mode
parameter in this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we can remove later when we converge into a single CLI tool. This is to keep the existing feature in runner script :)
scripts/run.sh
Outdated
GOARCH=$(go env GOARCH) | ||
GOOS=$(go env GOOS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we are setting GOARCH
and GOOS
twice
Signed-off-by: Gyuho Lee <gyuho.lee@avalabs.org>