github.com/MetalBlockchain/subnet-evm@v0.4.9/tests/precompile/precompile_test.go (about) 1 // Copyright (C) 2023, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package precompile 5 6 import ( 7 "context" 8 "os" 9 "testing" 10 "time" 11 12 "github.com/MetalBlockchain/metalgo/api/health" 13 "github.com/MetalBlockchain/subnet-evm/tests/utils" 14 "github.com/ethereum/go-ethereum/log" 15 "github.com/go-cmd/cmd" 16 ginkgo "github.com/onsi/ginkgo/v2" 17 "github.com/onsi/gomega" 18 19 // Import the solidity package, so that ginkgo maps out the tests declared within the package 20 _ "github.com/MetalBlockchain/subnet-evm/tests/precompile/solidity" 21 ) 22 23 var startCmd *cmd.Cmd 24 25 func TestE2E(t *testing.T) { 26 gomega.RegisterFailHandler(ginkgo.Fail) 27 ginkgo.RunSpecs(t, "subnet-evm precompile ginkgo test suite") 28 } 29 30 // BeforeSuite starts an MetalGo process to use for the e2e tests 31 var _ = ginkgo.BeforeSuite(func() { 32 ctx, cancel := context.WithTimeout(context.Background(), time.Minute) 33 defer cancel() 34 35 wd, err := os.Getwd() 36 gomega.Expect(err).Should(gomega.BeNil()) 37 log.Info("Starting MetalGo node", "wd", wd) 38 startCmd, err = utils.RunCommand("./scripts/run.sh") 39 gomega.Expect(err).Should(gomega.BeNil()) 40 41 // Assumes that startCmd will launch a node with HTTP Port at [utils.DefaultLocalNodeURI] 42 healthClient := health.NewClient(utils.DefaultLocalNodeURI) 43 healthy, err := health.AwaitReady(ctx, healthClient, 5*time.Second) 44 gomega.Expect(err).Should(gomega.BeNil()) 45 gomega.Expect(healthy).Should(gomega.BeTrue()) 46 log.Info("MetalGo node is healthy") 47 }) 48 49 var _ = ginkgo.AfterSuite(func() { 50 gomega.Expect(startCmd).ShouldNot(gomega.BeNil()) 51 gomega.Expect(startCmd.Stop()).Should(gomega.BeNil()) 52 // TODO add a new node to bootstrap off of the existing node and ensure it can bootstrap all subnets 53 // created during the test 54 })