From 718128aacc1989a2311b0551a2a1ad3d5ce52be8 Mon Sep 17 00:00:00 2001 From: marun Date: Wed, 4 Sep 2024 20:06:32 -0700 Subject: [PATCH] [testing] Cleanup ginkgo imports (#3362) --- tests/e2e/banff/suites.go | 3 +-- tests/e2e/c/dynamic_fees.go | 3 +-- tests/e2e/c/interchain_workflow.go | 3 +-- tests/e2e/e2e_test.go | 3 +-- tests/e2e/etna/suites.go | 3 +-- tests/e2e/faultinjection/duplicate_node_id.go | 3 +-- tests/e2e/p/elastic_subnets.go | 3 +-- tests/e2e/p/interchain_workflow.go | 3 +-- tests/e2e/p/owner_retrieval.go | 3 +-- tests/e2e/p/permissionless_layer_one.go | 3 +-- tests/e2e/p/staking_rewards.go | 3 +-- tests/e2e/p/validator_sets.go | 3 +-- tests/e2e/p/workflow.go | 3 +-- tests/e2e/vms/xsvm.go | 3 +-- tests/e2e/x/interchain_workflow.go | 3 +-- tests/e2e/x/transfer/virtuous.go | 3 +-- tests/fixture/e2e/describe.go | 4 +--- tests/fixture/e2e/env.go | 3 +-- tests/fixture/e2e/ginkgo_test_context.go | 3 +-- tests/fixture/e2e/metrics_link.go | 7 +++++-- 20 files changed, 24 insertions(+), 41 deletions(-) diff --git a/tests/e2e/banff/suites.go b/tests/e2e/banff/suites.go index 2790077a1a04..f89203cd510e 100644 --- a/tests/e2e/banff/suites.go +++ b/tests/e2e/banff/suites.go @@ -5,6 +5,7 @@ package banff import ( + "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/ids" @@ -14,8 +15,6 @@ import ( "github.com/ava-labs/avalanchego/vms/components/avax" "github.com/ava-labs/avalanchego/vms/components/verify" "github.com/ava-labs/avalanchego/vms/secp256k1fx" - - ginkgo "github.com/onsi/ginkgo/v2" ) var _ = ginkgo.Describe("[Banff]", func() { diff --git a/tests/e2e/c/dynamic_fees.go b/tests/e2e/c/dynamic_fees.go index 409d41056e1f..873b76f9a684 100644 --- a/tests/e2e/c/dynamic_fees.go +++ b/tests/e2e/c/dynamic_fees.go @@ -12,12 +12,11 @@ import ( "github.com/ava-labs/coreth/plugin/evm" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" + "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/tests/fixture/e2e" "github.com/ava-labs/avalanchego/tests/fixture/tmpnet" - - ginkgo "github.com/onsi/ginkgo/v2" ) // This test uses the compiled bin for `hashing.sol` as diff --git a/tests/e2e/c/interchain_workflow.go b/tests/e2e/c/interchain_workflow.go index 613020700454..f4b9cc85c544 100644 --- a/tests/e2e/c/interchain_workflow.go +++ b/tests/e2e/c/interchain_workflow.go @@ -8,6 +8,7 @@ import ( "github.com/ava-labs/coreth/core/types" "github.com/ava-labs/coreth/plugin/evm" + "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/ids" @@ -17,8 +18,6 @@ import ( "github.com/ava-labs/avalanchego/utils/units" "github.com/ava-labs/avalanchego/vms/secp256k1fx" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" - - ginkgo "github.com/onsi/ginkgo/v2" ) var _ = e2e.DescribeCChain("[Interchain Workflow]", func() { diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index eb2dbb6e7e6c..017687038448 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -8,6 +8,7 @@ import ( "encoding/json" "testing" + "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" // ensure test packages are scanned by ginkgo @@ -24,8 +25,6 @@ import ( "github.com/ava-labs/avalanchego/tests/fixture/e2e" "github.com/ava-labs/avalanchego/tests/fixture/tmpnet" "github.com/ava-labs/avalanchego/upgrade" - - ginkgo "github.com/onsi/ginkgo/v2" ) func TestE2E(t *testing.T) { diff --git a/tests/e2e/etna/suites.go b/tests/e2e/etna/suites.go index f78d561f9b92..60ecd0ff6252 100644 --- a/tests/e2e/etna/suites.go +++ b/tests/e2e/etna/suites.go @@ -7,12 +7,11 @@ package etna import ( "time" + "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/api/info" "github.com/ava-labs/avalanchego/tests/fixture/e2e" - - ginkgo "github.com/onsi/ginkgo/v2" ) var _ = ginkgo.Describe("[Etna]", func() { diff --git a/tests/e2e/faultinjection/duplicate_node_id.go b/tests/e2e/faultinjection/duplicate_node_id.go index 5032a0e306bb..d0a72d5b0574 100644 --- a/tests/e2e/faultinjection/duplicate_node_id.go +++ b/tests/e2e/faultinjection/duplicate_node_id.go @@ -7,6 +7,7 @@ import ( "context" "fmt" + "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/api/info" @@ -16,8 +17,6 @@ import ( "github.com/ava-labs/avalanchego/tests/fixture/e2e" "github.com/ava-labs/avalanchego/tests/fixture/tmpnet" "github.com/ava-labs/avalanchego/utils/set" - - ginkgo "github.com/onsi/ginkgo/v2" ) var _ = ginkgo.Describe("Duplicate node handling", func() { diff --git a/tests/e2e/p/elastic_subnets.go b/tests/e2e/p/elastic_subnets.go index 100ff81780ce..6fdd8966c302 100644 --- a/tests/e2e/p/elastic_subnets.go +++ b/tests/e2e/p/elastic_subnets.go @@ -7,6 +7,7 @@ import ( "fmt" "time" + "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/api/info" @@ -21,8 +22,6 @@ import ( "github.com/ava-labs/avalanchego/vms/platformvm/signer" "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/vms/secp256k1fx" - - ginkgo "github.com/onsi/ginkgo/v2" ) var _ = e2e.DescribePChain("[Elastic Subnets]", func() { diff --git a/tests/e2e/p/interchain_workflow.go b/tests/e2e/p/interchain_workflow.go index e612658bb8fe..a190a5a75131 100644 --- a/tests/e2e/p/interchain_workflow.go +++ b/tests/e2e/p/interchain_workflow.go @@ -8,6 +8,7 @@ import ( "time" "github.com/ava-labs/coreth/plugin/evm" + "github.com/onsi/ginkgo/v2" "github.com/spf13/cast" "github.com/stretchr/testify/require" @@ -24,8 +25,6 @@ import ( "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/vms/secp256k1fx" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" - - ginkgo "github.com/onsi/ginkgo/v2" ) var _ = e2e.DescribePChain("[Interchain Workflow]", ginkgo.Label(e2e.UsesCChainLabel), func() { diff --git a/tests/e2e/p/owner_retrieval.go b/tests/e2e/p/owner_retrieval.go index 2e0b08ac2c46..a92c256a2c93 100644 --- a/tests/e2e/p/owner_retrieval.go +++ b/tests/e2e/p/owner_retrieval.go @@ -4,6 +4,7 @@ package p import ( + "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/ids" @@ -11,8 +12,6 @@ import ( "github.com/ava-labs/avalanchego/utils/constants" "github.com/ava-labs/avalanchego/vms/platformvm" "github.com/ava-labs/avalanchego/vms/secp256k1fx" - - ginkgo "github.com/onsi/ginkgo/v2" ) var _ = e2e.DescribePChain("[P-Chain Wallet]", func() { diff --git a/tests/e2e/p/permissionless_layer_one.go b/tests/e2e/p/permissionless_layer_one.go index 0420be83d0da..844b3a257341 100644 --- a/tests/e2e/p/permissionless_layer_one.go +++ b/tests/e2e/p/permissionless_layer_one.go @@ -6,6 +6,7 @@ package p import ( "time" + "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/api/info" @@ -14,8 +15,6 @@ import ( "github.com/ava-labs/avalanchego/utils/constants" "github.com/ava-labs/avalanchego/vms/platformvm" "github.com/ava-labs/avalanchego/vms/secp256k1fx" - - ginkgo "github.com/onsi/ginkgo/v2" ) var _ = e2e.DescribePChain("[Permissionless L1]", func() { diff --git a/tests/e2e/p/staking_rewards.go b/tests/e2e/p/staking_rewards.go index 3f6023780f22..84156a9b74d4 100644 --- a/tests/e2e/p/staking_rewards.go +++ b/tests/e2e/p/staking_rewards.go @@ -7,6 +7,7 @@ import ( "time" "github.com/mitchellh/mapstructure" + "github.com/onsi/ginkgo/v2" "github.com/spf13/cast" "github.com/stretchr/testify/require" @@ -24,8 +25,6 @@ import ( "github.com/ava-labs/avalanchego/vms/platformvm/reward" "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/vms/secp256k1fx" - - ginkgo "github.com/onsi/ginkgo/v2" ) var _ = ginkgo.Describe("[Staking Rewards]", func() { diff --git a/tests/e2e/p/validator_sets.go b/tests/e2e/p/validator_sets.go index 81c6ab8178a9..78c8e4ac4bb4 100644 --- a/tests/e2e/p/validator_sets.go +++ b/tests/e2e/p/validator_sets.go @@ -7,6 +7,7 @@ import ( "fmt" "time" + "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/genesis" @@ -17,8 +18,6 @@ import ( "github.com/ava-labs/avalanchego/vms/platformvm" "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/vms/secp256k1fx" - - ginkgo "github.com/onsi/ginkgo/v2" ) var _ = e2e.DescribePChain("[Validator Sets]", func() { diff --git a/tests/e2e/p/workflow.go b/tests/e2e/p/workflow.go index 34e4145608d7..c3d654393ffb 100644 --- a/tests/e2e/p/workflow.go +++ b/tests/e2e/p/workflow.go @@ -6,6 +6,7 @@ package p import ( "time" + "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/ids" @@ -20,8 +21,6 @@ import ( "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/vms/secp256k1fx" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" - - ginkgo "github.com/onsi/ginkgo/v2" ) // PChainWorkflow is an integration test for normal P-Chain operations diff --git a/tests/e2e/vms/xsvm.go b/tests/e2e/vms/xsvm.go index 22add7550b5d..bb0e3d81809e 100644 --- a/tests/e2e/vms/xsvm.go +++ b/tests/e2e/vms/xsvm.go @@ -7,6 +7,7 @@ import ( "fmt" "time" + "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/ids" @@ -19,8 +20,6 @@ import ( "github.com/ava-labs/avalanchego/vms/example/xsvm/cmd/issue/export" "github.com/ava-labs/avalanchego/vms/example/xsvm/cmd/issue/importtx" "github.com/ava-labs/avalanchego/vms/example/xsvm/cmd/issue/transfer" - - ginkgo "github.com/onsi/ginkgo/v2" ) const pollingInterval = 50 * time.Millisecond diff --git a/tests/e2e/x/interchain_workflow.go b/tests/e2e/x/interchain_workflow.go index e1d5e5dbb8e5..33f26cbc9bb4 100644 --- a/tests/e2e/x/interchain_workflow.go +++ b/tests/e2e/x/interchain_workflow.go @@ -7,6 +7,7 @@ import ( "math/big" "github.com/ava-labs/coreth/plugin/evm" + "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/ids" @@ -17,8 +18,6 @@ import ( "github.com/ava-labs/avalanchego/vms/components/avax" "github.com/ava-labs/avalanchego/vms/secp256k1fx" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" - - ginkgo "github.com/onsi/ginkgo/v2" ) var _ = e2e.DescribeXChain("[Interchain Workflow]", ginkgo.Label(e2e.UsesCChainLabel), func() { diff --git a/tests/e2e/x/transfer/virtuous.go b/tests/e2e/x/transfer/virtuous.go index 5c59b599ba40..20b7896a14be 100644 --- a/tests/e2e/x/transfer/virtuous.go +++ b/tests/e2e/x/transfer/virtuous.go @@ -9,6 +9,7 @@ import ( "math/rand" "time" + "github.com/onsi/ginkgo/v2" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" @@ -25,8 +26,6 @@ import ( "github.com/ava-labs/avalanchego/vms/secp256k1fx" "github.com/ava-labs/avalanchego/wallet/subnet/primary" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" - - ginkgo "github.com/onsi/ginkgo/v2" ) const ( diff --git a/tests/fixture/e2e/describe.go b/tests/fixture/e2e/describe.go index 2810117758c6..1c97ccf35c01 100644 --- a/tests/fixture/e2e/describe.go +++ b/tests/fixture/e2e/describe.go @@ -3,9 +3,7 @@ package e2e -import ( - ginkgo "github.com/onsi/ginkgo/v2" -) +import "github.com/onsi/ginkgo/v2" const ( // For label usage in ginkgo invocation, see: https://onsi.github.io/ginkgo/#spec-labels diff --git a/tests/fixture/e2e/env.go b/tests/fixture/e2e/env.go index f39961dfb522..34748a9877d9 100644 --- a/tests/fixture/e2e/env.go +++ b/tests/fixture/e2e/env.go @@ -10,6 +10,7 @@ import ( "os" "time" + "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/api/info" @@ -18,8 +19,6 @@ import ( "github.com/ava-labs/avalanchego/tests/fixture/tmpnet" "github.com/ava-labs/avalanchego/utils/crypto/secp256k1" "github.com/ava-labs/avalanchego/vms/secp256k1fx" - - ginkgo "github.com/onsi/ginkgo/v2" ) // Env is used to access shared test fixture. Intended to be diff --git a/tests/fixture/e2e/ginkgo_test_context.go b/tests/fixture/e2e/ginkgo_test_context.go index 39592ae30ce9..912c144db3e1 100644 --- a/tests/fixture/e2e/ginkgo_test_context.go +++ b/tests/fixture/e2e/ginkgo_test_context.go @@ -8,13 +8,12 @@ import ( "io" "time" + "github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2/formatter" "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/tests" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" - - ginkgo "github.com/onsi/ginkgo/v2" ) type GinkgoTestContext struct{} diff --git a/tests/fixture/e2e/metrics_link.go b/tests/fixture/e2e/metrics_link.go index 97ccd7e7d3d9..5f20e3ff88c4 100644 --- a/tests/fixture/e2e/metrics_link.go +++ b/tests/fixture/e2e/metrics_link.go @@ -7,9 +7,9 @@ import ( "strconv" "time" - "github.com/ava-labs/avalanchego/tests/fixture/tmpnet" + "github.com/onsi/ginkgo/v2" - ginkgo "github.com/onsi/ginkgo/v2" + "github.com/ava-labs/avalanchego/tests/fixture/tmpnet" ) // The ginkgo event handlers defined in this file will be automatically @@ -36,6 +36,9 @@ var _ = ginkgo.BeforeEach(func() { var _ = ginkgo.AfterEach(func() { tc := NewTestContext() env := GetEnv(tc) + // The global env isn't guaranteed to be initialized by importers + // of this package since initializing a package-local env is also + // supported. if env == nil || !EmitMetricsLink { return }