diff --git a/graft/coreth/tests/warp/warp_test.go b/graft/coreth/tests/warp/warp_test.go index 02534ce9a188..9806573d0dfc 100644 --- a/graft/coreth/tests/warp/warp_test.go +++ b/graft/coreth/tests/warp/warp_test.go @@ -121,32 +121,51 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte { }) var _ = ginkgo.Describe("[Warp]", func() { - testFunc := func(sendingSubnet *Subnet, receivingSubnet *Subnet) { - tc := e2e.NewTestContext() - w := newWarpTest(tc.DefaultContext(), sendingSubnet, receivingSubnet) + type testCombination struct { + name string + sendingSubnet func() *Subnet + receivingSubnet func() *Subnet + } + + testCombinations := []testCombination{ + // TODO: Uncomment these tests when we have a way to run them in CI, currently we should not depend on Subnet-EVM + // as Coreth and Subnet-EVM have different release cycles. The problem is that once we update AvalancheGo (protocol version), + // we need to update Subnet-EVM to the same protocol version. Until then all Subnet-EVM tests are broken, so it's blocking Coreth development. + // It's best to not run these tests until we have a way to run them in CI. + // {"SubnetA -> C-Chain", func() *Subnet { return subnetA }, func() *Subnet { return cChainSubnetDetails }}, + // {"C-Chain -> SubnetA", func() *Subnet { return cChainSubnetDetails }, func() *Subnet { return subnetA }}, + {"C-Chain -> C-Chain", func() *Subnet { return cChainSubnetDetails }, func() *Subnet { return cChainSubnetDetails }}, + } + + for _, combination := range testCombinations { + ginkgo.Describe(combination.name, ginkgo.Ordered, func() { + var w *warpTest + + ginkgo.BeforeAll(func() { + w = newWarpTest(combination.sendingSubnet(), combination.receivingSubnet()) + }) - ginkgo.GinkgoLogr.Info("Sending message from A to B") - w.sendMessageFromSendingSubnet() + ginkgo.It("should send warp message from sending subnet", func() { + w.sendMessageFromSendingSubnet() + }) - ginkgo.GinkgoLogr.Info("Aggregating signatures via API") - w.aggregateSignaturesViaAPI() + ginkgo.It("should aggregate signatures via API", func() { + w.aggregateSignaturesViaAPI() + }) - ginkgo.GinkgoLogr.Info("Delivering addressed call payload to receiving subnet") - w.deliverAddressedCallToReceivingSubnet() + ginkgo.It("should deliver addressed call payload to receiving subnet", func() { + w.deliverAddressedCallToReceivingSubnet() + }) - ginkgo.GinkgoLogr.Info("Delivering block hash payload to receiving subnet") - w.deliverBlockHashPayload() + ginkgo.It("should deliver block hash payload", func() { + w.deliverBlockHashPayload() + }) - ginkgo.GinkgoLogr.Info("Executing warp load test") - w.warpLoad() + ginkgo.It("should handle warp load testing", func() { + w.warpLoad() + }) + }) } - // TODO: Uncomment these tests when we have a way to run them in CI, currently we should not depend on Subnet-EVM - // as Coreth and Subnet-EVM have different release cycles. The problem is that once we update AvalancheGo (protocol version), - // we need to update Subnet-EVM to the same protocol version. Until then all Subnet-EVM tests are broken, so it's blocking Coreth development. - // It's best to not run these tests until we have a way to run them in CI. - // ginkgo.It("SubnetA -> C-Chain", func() { testFunc(subnetA, cChainSubnetDetails) }) - // ginkgo.It("C-Chain -> SubnetA", func() { testFunc(cChainSubnetDetails, subnetA) }) - ginkgo.It("C-Chain -> C-Chain", func() { testFunc(cChainSubnetDetails, cChainSubnetDetails) }) }) type warpTest struct { @@ -178,8 +197,10 @@ type warpTest struct { addressedCallSignedMessage *avalancheWarp.Message } -func newWarpTest(ctx context.Context, sendingSubnet *Subnet, receivingSubnet *Subnet) *warpTest { +func newWarpTest(sendingSubnet *Subnet, receivingSubnet *Subnet) *warpTest { require := require.New(ginkgo.GinkgoT()) + tc := e2e.NewTestContext() + ctx := tc.DefaultContext() sendingSubnetFundedKey := sendingSubnet.PreFundedKey receivingSubnetFundedKey := receivingSubnet.PreFundedKey @@ -240,9 +261,9 @@ func (w *warpTest) initClients() { } func (w *warpTest) sendMessageFromSendingSubnet() { + require := require.New(ginkgo.GinkgoT()) tc := e2e.NewTestContext() ctx := tc.DefaultContext() - require := require.New(ginkgo.GinkgoT()) client := w.sendingSubnetClients[0] diff --git a/graft/subnet-evm/tests/warp/warp_test.go b/graft/subnet-evm/tests/warp/warp_test.go index 9e8b1bca25a4..cc4acc94a318 100644 --- a/graft/subnet-evm/tests/warp/warp_test.go +++ b/graft/subnet-evm/tests/warp/warp_test.go @@ -155,33 +155,53 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte { }) var _ = ginkgo.Describe("[Warp]", func() { - testFunc := func(sendingSubnet *Subnet, receivingSubnet *Subnet) { - tc := e2e.NewTestContext() - w := newWarpTest(tc.DefaultContext(), sendingSubnet, receivingSubnet) + type testCombination struct { + name string + sendingSubnet func() *Subnet + receivingSubnet func() *Subnet + } + + testCombinations := []testCombination{ + {"SubnetA -> SubnetB", func() *Subnet { return subnetA }, func() *Subnet { return subnetB }}, + {"SubnetA -> SubnetA", func() *Subnet { return subnetA }, func() *Subnet { return subnetA }}, + {"SubnetA -> C-Chain", func() *Subnet { return subnetA }, func() *Subnet { return cChainSubnetDetails }}, + {"C-Chain -> SubnetA", func() *Subnet { return cChainSubnetDetails }, func() *Subnet { return subnetA }}, + {"C-Chain -> C-Chain", func() *Subnet { return cChainSubnetDetails }, func() *Subnet { return cChainSubnetDetails }}, + } - log.Info("Sending message from A to B") - w.sendMessageFromSendingSubnet() + for _, combination := range testCombinations { + ginkgo.Describe(combination.name, ginkgo.Ordered, func() { + var w *warpTest - log.Info("Aggregating signatures via API") - w.aggregateSignaturesViaAPI() + ginkgo.BeforeAll(func() { + w = newWarpTest(combination.sendingSubnet(), combination.receivingSubnet()) + }) - log.Info("Delivering addressed call payload to receiving subnet") - w.deliverAddressedCallToReceivingSubnet() + ginkgo.It("should send warp message from sending subnet", func() { + w.sendMessageFromSendingSubnet() + }) - log.Info("Delivering block hash payload to receiving subnet") - w.deliverBlockHashPayload() + ginkgo.It("should aggregate signatures via API", func() { + w.aggregateSignaturesViaAPI() + }) - log.Info("bindings test: verifying warp message and blockchain ID") - w.warpBindingsTest() + ginkgo.It("should deliver addressed call payload to receiving subnet", func() { + w.deliverAddressedCallToReceivingSubnet() + }) - log.Info("Executing warp load test") - w.warpLoad() + ginkgo.It("should deliver block hash payload", func() { + w.deliverBlockHashPayload() + }) + + ginkgo.It("should verify warp bindings", func() { + w.warpBindingsTest() + }) + + ginkgo.It("should handle warp load testing", func() { + w.warpLoad() + }) + }) } - ginkgo.It("SubnetA -> SubnetB", func() { testFunc(subnetA, subnetB) }) - ginkgo.It("SubnetA -> SubnetA", func() { testFunc(subnetA, subnetA) }) - ginkgo.It("SubnetA -> C-Chain", func() { testFunc(subnetA, cChainSubnetDetails) }) - ginkgo.It("C-Chain -> SubnetA", func() { testFunc(cChainSubnetDetails, subnetA) }) - ginkgo.It("C-Chain -> C-Chain", func() { testFunc(cChainSubnetDetails, cChainSubnetDetails) }) }) type warpTest struct { @@ -213,8 +233,10 @@ type warpTest struct { addressedCallSignedMessage *avalancheWarp.Message } -func newWarpTest(ctx context.Context, sendingSubnet *Subnet, receivingSubnet *Subnet) *warpTest { +func newWarpTest(sendingSubnet *Subnet, receivingSubnet *Subnet) *warpTest { require := require.New(ginkgo.GinkgoT()) + tc := e2e.NewTestContext() + ctx := tc.DefaultContext() sendingSubnetFundedKey := sendingSubnet.PreFundedKey receivingSubnetFundedKey := receivingSubnet.PreFundedKey @@ -289,9 +311,10 @@ func (*warpTest) getBlockHashAndNumberFromTxReceipt(ctx context.Context, client } func (w *warpTest) sendMessageFromSendingSubnet() { + require := require.New(ginkgo.GinkgoT()) tc := e2e.NewTestContext() ctx := tc.DefaultContext() - require := require.New(ginkgo.GinkgoT()) + client := w.sendingSubnetClients[0] blockHash, blockNumber := w.sendWarpMessageTx(ctx, client)