Skip to content

Comments

Core Test Function#2762

Merged
sukantoraymond merged 3 commits intomainfrom
core-test-func
Apr 25, 2025
Merged

Core Test Function#2762
sukantoraymond merged 3 commits intomainfrom
core-test-func

Conversation

@sukantoraymond
Copy link
Contributor

One common function for E2E tests for all commands

Comment on lines 24 to 54
const ewoqEVMAddress = "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC"

var _ = ginkgo.Describe("[Blockchain Deploy Flags]", ginkgo.Ordered, func() {
_ = ginkgo.BeforeEach(func() {
// Create test subnet config
commands.CreateEtnaSubnetEvmConfig(subnetName, ewoqEVMAddress, commands.PoA)
})

ginkgo.AfterEach(func() {
commands.CleanNetwork()
// Cleanup test subnet config
commands.DeleteSubnetConfig(subnetName)
})
blockchainCmdArgs := []string{subnetName}
ginkgo.It("HAPPY PATH: local deploy default", func() {
testFlags := commandse2e.TestFlags{}
output, err := commandse2e.TestCommand(commandse2e.BlockchainCmd, "deploy", blockchainCmdArgs, testFlags)
gomega.Expect(output).Should(gomega.ContainSubstring("L1 is successfully deployed on Local Network"))
gomega.Expect(err).Should(gomega.BeNil())
})

ginkgo.It("ERROR PATH: invalid_version", func() {
testFlags := commandse2e.TestFlags{
"avalanchego-version": "invalid_version",
}
output, err := commandse2e.TestCommand(commandse2e.BlockchainCmd, "deploy", blockchainCmdArgs, testFlags)
fmt.Printf("obtained output %s \n", string(output))
gomega.Expect(err).Should(gomega.HaveOccurred())
gomega.Expect(output).Should(gomega.ContainSubstring("invalid version string"))
})
})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Example of how to use it

}

// TestCommand tests a CLI command with flag inputs
func TestCommand(commandGroup CommandGroup, command string, args []string, testFlags TestFlags) (string, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

core test function

Copy link

@Tonix517 Tonix517 left a comment

Choose a reason for hiding this comment

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

loving this approach

@github-project-automation github-project-automation bot moved this from Backlog 🗄️ to In Review 👀 in avalanchego Apr 24, 2025
@sukantoraymond sukantoraymond merged commit 1e8290a into main Apr 25, 2025
37 checks passed
@sukantoraymond sukantoraymond deleted the core-test-func branch April 25, 2025 16:34
@github-project-automation github-project-automation bot moved this from In Review 👀 to Done ✅ in avalanchego Apr 25, 2025
sukantoraymond added a commit that referenced this pull request Apr 25, 2025
sukantoraymond added a commit that referenced this pull request Apr 25, 2025
@sukantoraymond sukantoraymond restored the core-test-func branch April 25, 2025 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants