Skip to content

Commit

Permalink
[testing] Cleanup ginkgo imports (#3362)
Browse files Browse the repository at this point in the history
  • Loading branch information
marun authored Sep 5, 2024
1 parent 173345a commit 718128a
Show file tree
Hide file tree
Showing 20 changed files with 24 additions and 41 deletions.
3 changes: 1 addition & 2 deletions tests/e2e/banff/suites.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package banff

import (
"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/require"

"github.com/ava-labs/avalanchego/ids"
Expand All @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/c/dynamic_fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/c/interchain_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/etna/suites.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/faultinjection/duplicate_node_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"fmt"

"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/require"

"github.com/ava-labs/avalanchego/api/info"
Expand All @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/p/elastic_subnets.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"time"

"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/require"

"github.com/ava-labs/avalanchego/api/info"
Expand All @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/p/interchain_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/p/owner_retrieval.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
package p

import (
"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/require"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/tests/fixture/e2e"
"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() {
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/p/permissionless_layer_one.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/p/staking_rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

"github.com/mitchellh/mapstructure"
"github.com/onsi/ginkgo/v2"
"github.com/spf13/cast"
"github.com/stretchr/testify/require"

Expand All @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/p/validator_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"time"

"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/require"

"github.com/ava-labs/avalanchego/genesis"
Expand All @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/p/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package p
import (
"time"

"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/require"

"github.com/ava-labs/avalanchego/ids"
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/vms/xsvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"time"

"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/require"

"github.com/ava-labs/avalanchego/ids"
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/x/interchain_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/x/transfer/virtuous.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"math/rand"
"time"

"github.com/onsi/ginkgo/v2"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/require"

Expand All @@ -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 (
Expand Down
4 changes: 1 addition & 3 deletions tests/fixture/e2e/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions tests/fixture/e2e/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"time"

"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/require"

"github.com/ava-labs/avalanchego/api/info"
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions tests/fixture/e2e/ginkgo_test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
7 changes: 5 additions & 2 deletions tests/fixture/e2e/metrics_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit 718128a

Please sign in to comment.