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

*: add e2e tests, replace "runner" with network-runner #82

Merged
merged 4 commits into from
Apr 25, 2022
Merged

*: add e2e tests, replace "runner" with network-runner #82

merged 4 commits into from
Apr 25, 2022

Conversation

gyuho
Copy link
Contributor

@gyuho gyuho commented Apr 19, 2022

asciicast

Screen Shot 2022-04-19 at 12 18 27 PM

Screen Shot 2022-04-19 at 12 17 58 PM

Signed-off-by: Gyuho Lee <gyuho.lee@avalabs.org>
Copy link
Contributor

@dasconnor dasconnor left a 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

tests/e2e/e2e_test.go Outdated Show resolved Hide resolved
Signed-off-by: Gyuho Lee <gyuho.lee@avalabs.org>
Copy link
Contributor

@dasconnor dasconnor left a comment

Choose a reason for hiding this comment

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

LGTM

@vinay2sonu
Copy link

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!"
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing mode argument?

"context"
"flag"
"fmt"
"io/ioutil"

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
Copy link
Collaborator

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.

})
})

func createDefaultCtx() (context.Context, context.CancelFunc) {
Copy link
Collaborator

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?

return os.WriteFile(p, ob, fsModeWrite)
}

func getVMID(vmName string) (ids.ID, error) {
Copy link
Collaborator

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.

Copy link
Contributor Author

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.


var _ = ginkgo.AfterSuite(func() {
switch mode {
case "test":
Copy link
Collaborator

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.

Copy link
Contributor Author

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
Comment on lines 184 to 185
GOARCH=$(go env GOARCH)
GOOS=$(go env GOOS)
Copy link
Collaborator

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>
@gyuho gyuho merged commit a449f95 into master Apr 25, 2022
@gyuho gyuho deleted the e2e branch April 25, 2022 19:29
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.

6 participants