Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
"\\[Local Network\\]",
"\\[Network\\]",
"\\[Blockchain Configure\\]",
"\\[Package Management\\]",
# "\\[Package Management\\]",
"\\[Root\\]",
"\\[Local Subnet non SOV\\]",
"\\[Subnet Compatibility\\]",
Expand Down
5 changes: 3 additions & 2 deletions cmd/blockchaincmd/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/ava-labs/avalanche-cli/pkg/prompts"
"github.com/ava-labs/avalanche-cli/pkg/ux"
"github.com/ava-labs/avalanche-cli/pkg/vm"
"github.com/ava-labs/avalanche-cli/tests/e2e/utils"
Copy link
Author

Choose a reason for hiding this comment

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

this will cause cyclic dependency issue. also test code should not be included in prod code

"github.com/ava-labs/avalanchego/utils/logging"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
Expand All @@ -35,7 +34,9 @@ func TestExportImportSubnet(t *testing.T) {

app.Setup(testDir, logging.NoLog{}, nil, "", prompts.NewPrompter(), &mockAppDownloader, nil)
ux.NewUserLog(logging.NoLog{}, io.Discard)
genBytes, err := os.ReadFile("../../" + utils.SubnetEvmGenesisPath)

subnetEvmGenesisPath := "tests/e2e/assets/test_subnet_evm_genesis.json"
genBytes, err := os.ReadFile("../../" + subnetEvmGenesisPath)
require.NoError(err)
sc, err := vm.CreateEvmSidecar(
nil,
Expand Down
13 changes: 13 additions & 0 deletions cmd/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (C) 2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package cmd

// CommandGroup represents the different command groups available in the CLI
type CommandGroup string

const (
BlockchainCmd CommandGroup = "blockchain"
ValidatorCmd CommandGroup = "validator"
ICMCmd CommandGroup = "icm"
InterchainCmd CommandGroup = "interchain"
)
3 changes: 2 additions & 1 deletion tests/e2e/commands/icm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package commands

import (
"github.com/ava-labs/avalanche-cli/cmd"
"github.com/ava-labs/avalanche-cli/tests/e2e/utils"
)

Expand All @@ -20,7 +21,7 @@ func SendICMMessage(args []string, testFlags utils.TestFlags) (string, error) {

/* #nosec G204 */
func DeployICMContracts(args []string, testFlags utils.TestFlags) (string, error) {
return utils.TestCommand(utils.ICMCmd, "deploy", args, utils.GlobalFlags{
return utils.TestCommand(cmd.ICMCmd, "deploy", args, utils.GlobalFlags{
"local": true,
"skip-update-check": true,
}, testFlags)
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/commands/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os/exec"
"strings"

"github.com/ava-labs/avalanche-cli/cmd"
"github.com/ava-labs/avalanche-cli/pkg/constants"
"github.com/ava-labs/avalanche-cli/pkg/models"
"github.com/ava-labs/avalanche-cli/tests/e2e/utils"
Expand Down Expand Up @@ -133,7 +134,7 @@ func CreateSubnetEvmConfigWithVersionSOV(subnetName string, genesisPath string,

func ConfigureBlockchain(blockchainName string, testFlags utils.TestFlags) (string, error) {
return utils.TestCommand(
utils.BlockchainCmd,
cmd.BlockchainCmd,
"configure",
[]string{blockchainName},
utils.GlobalFlags{},
Expand All @@ -143,7 +144,7 @@ func ConfigureBlockchain(blockchainName string, testFlags utils.TestFlags) (stri

func DeployBlockchain(blockchainName string, testFlags utils.TestFlags) (string, error) {
return utils.TestCommand(
utils.BlockchainCmd,
cmd.BlockchainCmd,
"deploy",
[]string{blockchainName},
utils.GlobalFlags{},
Expand Down
61 changes: 31 additions & 30 deletions tests/e2e/testcases/blockchain/convert/suite.go

Large diffs are not rendered by default.

61 changes: 31 additions & 30 deletions tests/e2e/testcases/blockchain/deploy/suite.go

Large diffs are not rendered by default.

45 changes: 23 additions & 22 deletions tests/e2e/testcases/icm/deploy/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"path"
"path/filepath"

"github.com/ava-labs/avalanche-cli/cmd"
"github.com/ava-labs/avalanche-cli/pkg/constants"
"github.com/ava-labs/avalanche-cli/pkg/interchain"
"github.com/ava-labs/avalanche-cli/sdk/evm"
Expand Down Expand Up @@ -51,7 +52,7 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
"--c-chain",
}

output, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(output).
Should(gomega.ContainSubstring("ICM Messenger successfully deployed to C-Chain"))
Expand Down Expand Up @@ -83,7 +84,7 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
}
commandArguments := []string{}

output, err = utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
output, err = utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(output).
Should(gomega.ContainSubstring("ICM Messenger successfully deployed to " + subnetName))
Expand Down Expand Up @@ -124,7 +125,7 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
"--c-chain",
}

output, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(output).
Should(gomega.ContainSubstring("ICM Messenger successfully deployed to C-Chain"))
Expand All @@ -141,7 +142,7 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
"--c-chain",
}

output, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(output).
ShouldNot(gomega.ContainSubstring("ICM Messenger successfully deployed to C-Chain"))
Expand All @@ -160,7 +161,7 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
}
commandArguments := []string{}

output, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(output).
Should(gomega.ContainSubstring("ICM Messenger successfully deployed to " + subnetName))
Expand All @@ -183,7 +184,7 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
}
commandArguments := []string{}

output, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(output).
ShouldNot(gomega.ContainSubstring("ICM Messenger successfully deployed to " + subnetName))
Expand All @@ -203,10 +204,10 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
"--c-chain",
}

_, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
_, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.BeNil())

output, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(output).Should(gomega.ContainSubstring("ICM Messenger has already been deployed to C-Chain"))
})
Expand All @@ -217,7 +218,7 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
}

_, err := utils.TestCommand(
utils.ICMCmd,
cmd.ICMCmd,
"deploy",
[]string{
"--c-chain",
Expand All @@ -227,7 +228,7 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
gomega.Expect(err).Should(gomega.BeNil())

output, err := utils.TestCommand(
utils.ICMCmd,
cmd.ICMCmd,
"deploy",
[]string{
"--c-chain",
Expand All @@ -249,10 +250,10 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
"--c-chain",
}

_, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
_, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.BeNil())

output, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(output).ShouldNot(gomega.ContainSubstring("ICM Messenger has already been deployed to C-Chain"))
gomega.Expect(output).ShouldNot(gomega.ContainSubstring("ICM Messenger successfully deployed to C-Chain"))
Expand All @@ -268,10 +269,10 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
"--c-chain",
}

_, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
_, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.BeNil())

output, err := utils.TestCommand(utils.ICMCmd, "deploy", append(commandArguments, "--force-registry-deploy"), globalFlags, testFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", append(commandArguments, "--force-registry-deploy"), globalFlags, testFlags)
gomega.Expect(err).Should(gomega.BeNil())

gomega.Expect(err).Should(gomega.BeNil())
Expand All @@ -289,10 +290,10 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
"--c-chain",
}

_, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
_, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.BeNil())

output, err := utils.TestCommand(utils.ICMCmd, "deploy", append(commandArguments, "--force-registry-deploy"), globalFlags, utils.TestFlags{
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", append(commandArguments, "--force-registry-deploy"), globalFlags, utils.TestFlags{
"key": ewoqKeyName,
})
gomega.Expect(err).Should(gomega.BeNil())
Expand Down Expand Up @@ -324,7 +325,7 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
"--c-chain",
}

output, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(output).
Should(gomega.ContainSubstring("ICM Messenger successfully deployed to C-Chain"))
Expand All @@ -343,7 +344,7 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
"--c-chain",
}

output, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
gomega.Expect(output).
Should(gomega.ContainSubstring("ICM Messenger successfully deployed to C-Chain"))
Expand All @@ -366,7 +367,7 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
}
commandArguments := []string{}

output, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.HaveOccurred())
gomega.Expect(output).
Should(gomega.ContainSubstring("are mutually exclusive flags"))
Expand All @@ -381,7 +382,7 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
"--c-chain",
}

output, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.HaveOccurred())
gomega.Expect(output).
Should(gomega.ContainSubstring("you should set at least one of --deploy-messenger/--deploy-registry to true"))
Expand All @@ -396,7 +397,7 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
"--c-chain",
}

output, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.HaveOccurred())
gomega.Expect(output).
Should(gomega.ContainSubstring("if setting any ICM asset path, you must set all ICM asset paths"))
Expand All @@ -411,7 +412,7 @@ var _ = ginkgo.Describe("[ICM] deploy", func() {
"--c-chain",
}

output, err := utils.TestCommand(utils.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "deploy", commandArguments, globalFlags, testFlags)
gomega.Expect(err).Should(gomega.HaveOccurred())
gomega.Expect(output).
Should(gomega.ContainSubstring("failed downloading"))
Expand Down
19 changes: 10 additions & 9 deletions tests/e2e/testcases/icm/sendMsg/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sendmsg
import (
"fmt"

"github.com/ava-labs/avalanche-cli/cmd"
"github.com/ava-labs/avalanche-cli/tests/e2e/commands"
"github.com/ava-labs/avalanche-cli/tests/e2e/utils"
ginkgo "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -81,7 +82,7 @@ var _ = ginkgo.Describe("[ICM] sendMsg", func() {
message,
}

output, err := utils.TestCommand(utils.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(output).Should(gomega.ContainSubstring(fmt.Sprintf("Delivering message \"%s\" from source blockchain \"%s\"", message, cChain)))
gomega.Expect(output).Should(gomega.ContainSubstring(fmt.Sprintf("Waiting for message to be delivered to destination blockchain \"%s\"", subnetName)))
Expand Down Expand Up @@ -122,7 +123,7 @@ var _ = ginkgo.Describe("[ICM] sendMsg", func() {
message,
}

output, err := utils.TestCommand(utils.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(output).Should(gomega.ContainSubstring(fmt.Sprintf("Delivering message \"%s\" from source blockchain \"%s\"", message, subnetName)))
gomega.Expect(output).Should(gomega.ContainSubstring(fmt.Sprintf("Waiting for message to be delivered to destination blockchain \"%s\"", cChain)))
Expand Down Expand Up @@ -173,7 +174,7 @@ var _ = ginkgo.Describe("[ICM] sendMsg", func() {
message,
}

output, err := utils.TestCommand(utils.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(output).Should(gomega.ContainSubstring(fmt.Sprintf("Delivering message \"%s\" from source blockchain \"%s\"", message, subnet2Name)))
gomega.Expect(output).Should(gomega.ContainSubstring(fmt.Sprintf("Waiting for message to be delivered to destination blockchain \"%s\"", subnetName)))
Expand Down Expand Up @@ -232,7 +233,7 @@ var _ = ginkgo.Describe("[ICM] sendMsg", func() {
message,
}

output, err = utils.TestCommand(utils.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
output, err = utils.TestCommand(cmd.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(output).Should(gomega.ContainSubstring(fmt.Sprintf("Delivering message \"%s\" from source blockchain \"%s\"", message, subnet2Name)))
gomega.Expect(output).Should(gomega.ContainSubstring(fmt.Sprintf("Waiting for message to be delivered to destination blockchain \"%s\"", subnetName)))
Expand Down Expand Up @@ -275,7 +276,7 @@ var _ = ginkgo.Describe("[ICM] sendMsg", func() {
"--hex-encoded",
}

output, err := utils.TestCommand(utils.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(output).Should(gomega.ContainSubstring(fmt.Sprintf("Delivering message \"%s\" from source blockchain \"%s\"", hexEncodedMessage, cChain)))
gomega.Expect(output).Should(gomega.ContainSubstring(fmt.Sprintf("Waiting for message to be delivered to destination blockchain \"%s\"", subnetName)))
Expand All @@ -295,7 +296,7 @@ var _ = ginkgo.Describe("[ICM] sendMsg", func() {
message,
}

output, err := utils.TestCommand(utils.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
gomega.Expect(err).ShouldNot(gomega.BeNil())
gomega.Expect(output).Should(gomega.ContainSubstring(fmt.Sprintf("subnet \"%s\" does not exist", subnetName)))
})
Expand All @@ -311,7 +312,7 @@ var _ = ginkgo.Describe("[ICM] sendMsg", func() {
message,
}

output, err := utils.TestCommand(utils.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
gomega.Expect(err).ShouldNot(gomega.BeNil())
gomega.Expect(output).Should(gomega.ContainSubstring(fmt.Sprintf("subnet \"%s\" does not exist", subnetName)))
})
Expand Down Expand Up @@ -354,7 +355,7 @@ var _ = ginkgo.Describe("[ICM] sendMsg", func() {
message,
}

output, err := utils.TestCommand(utils.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
gomega.Expect(err).ShouldNot(gomega.BeNil())
gomega.Expect(output).Should(gomega.ContainSubstring("Post \"http://127.0.0.1:61171/ext/bc/invalid-subnet/rpc\": dial tcp 127.0.0.1:61171: connect: connection refused"))
})
Expand Down Expand Up @@ -397,7 +398,7 @@ var _ = ginkgo.Describe("[ICM] sendMsg", func() {
message,
}

output, err := utils.TestCommand(utils.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
output, err := utils.TestCommand(cmd.ICMCmd, "sendMsg", sendMessageArgs, globalFlags, sendMsgFlags)
gomega.Expect(err).ShouldNot(gomega.BeNil())
gomega.Expect(output).Should(gomega.ContainSubstring("Post \"http://127.0.0.1:61171/ext/bc/invalid-subnet/rpc\": dial tcp 127.0.0.1:61171: connect: connection refused"))
})
Expand Down
Loading
Loading