Skip to content

Refactor warp e2e test to avoid a single sequential function #4699

Description

@JonathanOppenheimer

[No action needed] It's outside the scope of this PR since the tests were already set up this way, but I think there is opportunity to structure these in a more standard way rather than a big sequential testFunc

Something like:

    testCombinations := []struct {
		name            string
		sendingSubnet   *Subnet
		receivingSubnet *Subnet
	}{
		{"SubnetA -> SubnetB", subnetA, subnetB},
		{"SubnetA -> SubnetA", subnetA, subnetA},
		{"SubnetA -> C-Chain", subnetA, cChainSubnetDetails},
		{"C-Chain -> SubnetA", cChainSubnetDetails, subnetA},
		{"C-Chain -> C-Chain", cChainSubnetDetails, cChainSubnetDetails},
	}
    var _ = ginkgo.Describe("[Warp]", func() {
	for _, combination := range testCombinations {
		combination := combination
		
		ginkgo.Describe(combination.name, ginkgo.Ordered, func() {
			var w *warpTest
			
			ginkgo.BeforeAll(func() {
				tc := e2e.NewTestContext()
				w = newWarpTest(tc.DefaultContext(), combination.sendingSubnet, combination.receivingSubnet)
			})

			ginkgo.It("should send warp message from sending subnet", func() {
				w.sendMessageFromSendingSubnet()
			})

			ginkgo.It("should aggregate signatures via API", func() {
				w.aggregateSignaturesViaAPI()
			})

			ginkgo.It("should deliver addressed call payload to receiving subnet", func() {
				w.deliverAddressedCallToReceivingSubnet()
			})

			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()
			})
		})
	}
})

The above is AI assisted and not thoroughly reviewed (read likely not best), but generally should provide better failure isolation and breaks each specific functionality tested into it's own It which is generally best practice.

I mostly add this comment to be on the lookout for in the future.

Originally posted by @michaelkaplan13 in ava-labs/subnet-evm#1907 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

evmRelated to EVM functionalitysubnet-evmRelated to the former subnet-evm standalone repository

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions