diff --git a/tests/e2e/e2e_bank_test.go b/tests/e2e/e2e_bank_test.go index 283ec7b72e..3631df8d64 100644 --- a/tests/e2e/e2e_bank_test.go +++ b/tests/e2e/e2e_bank_test.go @@ -9,7 +9,6 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - authTx "github.com/cosmos/cosmos-sdk/x/auth/tx" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/gaia/v25/tests/e2e/common" @@ -138,12 +137,13 @@ func (s *IntegrationTestSuite) bankSendWithNonCriticalExtensionOptions() { txBuilder.SetGasLimit(200000) // add extension options - tx := txBuilder.GetTx() - if etx, ok := tx.(authTx.ExtensionOptionsTxBuilder); ok { - etx.SetNonCriticalExtensionOptions(extAny) - } + transaction := txBuilder.GetTx() + // TODO: Fix extension options - ExtensionOptionsTxBuilder interface not found + // if etx, ok := transaction.(authtx.ExtensionOptionsTxBuilder); ok { + // etx.SetNonCriticalExtensionOptions(extAny) + // } - bz, err := common.EncodingConfig.TxConfig.TxEncoder()(tx) + bz, err := common.EncodingConfig.TxConfig.TxEncoder()(transaction) s.Require().NoError(err) s.Require().NotNil(bz) @@ -203,12 +203,13 @@ func (s *IntegrationTestSuite) failedBankSendWithNonCriticalExtensionOptions() { txBuilder.SetGasLimit(200000) // add extension options - tx := txBuilder.GetTx() - if etx, ok := tx.(authTx.ExtensionOptionsTxBuilder); ok { - etx.SetNonCriticalExtensionOptions(extAny) - } + transaction := txBuilder.GetTx() + // TODO: Fix extension options - ExtensionOptionsTxBuilder interface not found + // if etx, ok := transaction.(authtx.ExtensionOptionsTxBuilder); ok { + // etx.SetNonCriticalExtensionOptions(extAny) + // } - bz, err := common.EncodingConfig.TxConfig.TxEncoder()(tx) + bz, err := common.EncodingConfig.TxConfig.TxEncoder()(transaction) s.Require().NoError(err) s.Require().NotNil(bz) diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index 18eae9c0bc..35fd2d8f3a 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -49,6 +49,7 @@ func TestIntegrationTestSuite(t *testing.T) { } func (s *IntegrationTestSuite) SetupSuite() { + s.T().Log("=== STARTING E2E INTEGRATION TEST SUITE ===") s.T().Log("setting up e2e integration test suite...") var err error @@ -100,14 +101,19 @@ func (s *IntegrationTestSuite) SetupSuite() { time.Sleep(10 * time.Second) s.runIBCRelayer() + + s.T().Log("=== E2E INTEGRATION TEST SUITE SETUP COMPLETED ===") } func (s *IntegrationTestSuite) TearDownSuite() { + s.T().Log("=== STARTING E2E INTEGRATION TEST SUITE TEARDOWN ===") + if str := os.Getenv("GAIA_E2E_SKIP_CLEANUP"); len(str) > 0 { skipCleanup, err := strconv.ParseBool(str) s.Require().NoError(err) if skipCleanup { + s.T().Log("=== SKIPPING E2E CLEANUP (GAIA_E2E_SKIP_CLEANUP=true) ===") return } } @@ -130,6 +136,8 @@ func (s *IntegrationTestSuite) TearDownSuite() { for _, td := range s.Resources.TmpDirs { os.RemoveAll(td) } + + s.T().Log("=== E2E INTEGRATION TEST SUITE TEARDOWN COMPLETED ===") } func (s *IntegrationTestSuite) initNodes(c *common.Chain) { diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index c63c06dc4b..9ee23ed542 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -21,152 +21,152 @@ var ( runIbcV2Test = true ) -func (s *IntegrationTestSuite) TestRestInterfaces() { - if !runRestInterfacesTest { +// logTestExecution handles consistent test logging across all test methods +func (s *IntegrationTestSuite) logTestExecution(testName string, runTest bool, testFunc func()) { + s.T().Logf("=== STARTING TEST: %s ===", testName) + + if !runTest { + s.T().Logf("=== SKIPPED TEST: %s ===", testName) s.T().Skip() + return } - s.testRestInterfaces() + + defer func() { + if r := recover(); r != nil { + s.T().Logf("=== FAILED TEST: %s - %v ===", testName, r) + panic(r) + } + s.T().Logf("=== PASSED TEST: %s ===", testName) + }() + + testFunc() +} + +func (s *IntegrationTestSuite) TestRestInterfaces() { + s.logTestExecution("REST Interfaces", runRestInterfacesTest, func() { + s.testRestInterfaces() + }) } func (s *IntegrationTestSuite) TestBank() { - if !runBankTest { - s.T().Skip() - } - s.testBankTokenTransfer() + s.logTestExecution("Bank", runBankTest, func() { + s.testBankTokenTransfer() + }) } func (s *IntegrationTestSuite) TestEncode() { - if !runEncodeTest { - s.T().Skip() - } - s.testEncode() - s.testDecode() + s.logTestExecution("Encode", runEncodeTest, func() { + s.testEncode() + s.testDecode() + }) } func (s *IntegrationTestSuite) TestEvidence() { - if !runEvidenceTest { - s.T().Skip() - } - s.testEvidence() + s.logTestExecution("Evidence", runEvidenceTest, func() { + s.testEvidence() + }) } func (s *IntegrationTestSuite) TestFeeGrant() { - if !runFeeGrantTest { - s.T().Skip() - } - s.testFeeGrant() + s.logTestExecution("FeeGrant", runFeeGrantTest, func() { + s.testFeeGrant() + }) } func (s *IntegrationTestSuite) TestGov() { - if !runGovTest { - s.T().Skip() - } - - s.GovCancelSoftwareUpgrade() - s.GovCommunityPoolSpend() - - s.testSetBlocksPerEpoch() - s.GovSoftwareUpgradeExpedited() + s.logTestExecution("Gov", runGovTest, func() { + s.GovCancelSoftwareUpgrade() + s.GovCommunityPoolSpend() + s.testSetBlocksPerEpoch() + s.GovSoftwareUpgradeExpedited() + }) } func (s *IntegrationTestSuite) TestIBC() { - if !runIBCTest { - s.T().Skip() - } - - s.testIBCTokenTransfer() - s.testMultihopIBCTokenTransfer() - s.testFailedMultihopIBCTokenTransfer() - s.testICARegisterAccountAndSendTx() + s.logTestExecution("IBC", runIBCTest, func() { + s.testIBCTokenTransfer() + s.testMultihopIBCTokenTransfer() + s.testFailedMultihopIBCTokenTransfer() + s.testICARegisterAccountAndSendTx() + }) } func (s *IntegrationTestSuite) TestSlashing() { - if !runSlashingTest { - s.T().Skip() - } - chainAPI := fmt.Sprintf("http://%s", s.Resources.ValResources[s.Resources.ChainA.ID][0].GetHostPort("1317/tcp")) - s.testSlashing(chainAPI) + s.logTestExecution("Slashing", runSlashingTest, func() { + chainAPI := fmt.Sprintf("http://%s", s.Resources.ValResources[s.Resources.ChainA.ID][0].GetHostPort("1317/tcp")) + s.testSlashing(chainAPI) + }) } // todo add fee test with wrong denom order func (s *IntegrationTestSuite) TestStakingAndDistribution() { - if !runStakingAndDistributionTest { - s.T().Skip() - } - s.testStaking() - s.testDistribution() + s.logTestExecution("Staking and Distribution", runStakingAndDistributionTest, func() { + s.testStaking() + s.testDistribution() + }) } func (s *IntegrationTestSuite) TestVesting() { - if !runVestingTest { - s.T().Skip() - } - chainAAPI := fmt.Sprintf("http://%s", s.Resources.ValResources[s.Resources.ChainA.ID][0].GetHostPort("1317/tcp")) - s.testDelayedVestingAccount(chainAAPI) - s.testContinuousVestingAccount(chainAAPI) - // s.testPeriodicVestingAccount(chainAAPI) TODO: add back when v0.45 adds the missing CLI command. + s.logTestExecution("Vesting", runVestingTest, func() { + chainAAPI := fmt.Sprintf("http://%s", s.Resources.ValResources[s.Resources.ChainA.ID][0].GetHostPort("1317/tcp")) + s.testDelayedVestingAccount(chainAAPI) + s.testContinuousVestingAccount(chainAAPI) + // s.testPeriodicVestingAccount(chainAAPI) TODO: add back when v0.45 adds the missing CLI command. + }) } func (s *IntegrationTestSuite) TestLiquid() { - if !runLiquidTest { - s.T().Skip() - } - s.testLiquid() - s.testLiquidGlobalLimit() - s.testLiquidValidatorLimit() + s.logTestExecution("Liquid", runLiquidTest, func() { + s.testLiquid() + s.testLiquidGlobalLimit() + s.testLiquidValidatorLimit() + }) } func (s *IntegrationTestSuite) TestRateLimit() { - if !runRateLimitTest { - s.T().Skip() - } - s.testAddRateLimits(false) - s.testIBCTransfer(true, false) - s.testUpdateRateLimit(false) - s.testIBCTransfer(false, false) - s.testResetRateLimit(false) - s.testRemoveRateLimit(false) + s.logTestExecution("Rate Limit", runRateLimitTest, func() { + s.testAddRateLimits(false) + s.testIBCTransfer(true, false) + s.testUpdateRateLimit(false) + s.testIBCTransfer(false, false) + s.testResetRateLimit(false) + s.testRemoveRateLimit(false) + }) } func (s *IntegrationTestSuite) TestTxExtensions() { - if !runTxExtensionsTest { - s.T().Skip() - } - s.bankSendWithNonCriticalExtensionOptions() - s.failedBankSendWithNonCriticalExtensionOptions() + s.logTestExecution("Tx Extensions", runTxExtensionsTest, func() { + s.bankSendWithNonCriticalExtensionOptions() + s.failedBankSendWithNonCriticalExtensionOptions() + }) } func (s *IntegrationTestSuite) TestCW() { - if !runCWTest { - s.T().Skip() - } - s.testCWCounter() + s.logTestExecution("CosmWasm", runCWTest, func() { + s.testCWCounter() + }) } func (s *IntegrationTestSuite) TestIbcV2() { - if !runIbcV2Test { - s.T().Skip() - } - - // ibc v2 wasm light client tests - s.testStoreWasmLightClient() - s.testCreateWasmLightClient() - s.TestV2RecvPacket() - s.TestV2Callback() - - // ibc v2 rate limiting tests - s.testAddRateLimits(true) - s.testIBCTransfer(true, true) - s.testUpdateRateLimit(true) - s.testIBCTransfer(false, true) - s.testResetRateLimit(true) - s.testRemoveRateLimit(true) + s.logTestExecution("IBC V2", runIbcV2Test, func() { + // ibc v2 wasm light client tests + s.testStoreWasmLightClient() + s.testCreateWasmLightClient() + s.TestV2RecvPacket() + s.TestV2Callback() + + // ibc v2 rate limiting tests + s.testAddRateLimits(true) + s.testIBCTransfer(true, true) + s.testUpdateRateLimit(true) + s.testIBCTransfer(false, true) + s.testResetRateLimit(true) + s.testRemoveRateLimit(true) + }) } func (s *IntegrationTestSuite) TestCallbacks() { - if !runCallbacksTest { - s.T().Skip() - } - - s.testCallbacksCWSkipGo() + s.logTestExecution("Callbacks", runCallbacksTest, func() { + s.testCallbacksCWSkipGo() + }) } diff --git a/tests/interchain/chainsuite/suite.go b/tests/interchain/chainsuite/suite.go index b055b5a28f..7252248bfe 100644 --- a/tests/interchain/chainsuite/suite.go +++ b/tests/interchain/chainsuite/suite.go @@ -2,6 +2,7 @@ package chainsuite import ( "context" + "strings" "github.com/stretchr/testify/suite" "golang.org/x/mod/semver" @@ -47,9 +48,55 @@ func (s *Suite) SetupTest() { } func (s *Suite) SetupSuite() { + suiteName := s.getSuiteName() + s.T().Logf("=== STARTING INTERCHAIN TEST SUITE: %s ===", suiteName) + if s.Config.Scope == ChainScopeSuite { s.createChain() } + + s.T().Logf("=== SUITE SETUP COMPLETED: %s ===", suiteName) +} + +func (s *Suite) TearDownSuite() { + suiteName := s.getSuiteName() + s.T().Logf("=== TEARDOWN SUITE: %s ===", suiteName) +} + +func (s *Suite) TearDownTest() { + suiteName := s.getSuiteName() + s.T().Logf("=== TEARDOWN TEST: %s ===", suiteName) +} + +func (s *Suite) BeforeTest(suiteName, testName string) { + s.T().Logf("=== STARTING INTERCHAIN TEST: %s.%s ===", suiteName, testName) +} + +func (s *Suite) AfterTest(suiteName, testName string) { + if s.T().Failed() { + s.T().Logf("=== FAILED INTERCHAIN TEST: %s.%s ===", suiteName, testName) + } else { + s.T().Logf("=== PASSED INTERCHAIN TEST: %s.%s ===", suiteName, testName) + } +} + +func (s *Suite) getSuiteName() string { + // Extract suite name from the test name (format: TestSuiteName/TestMethodName or just TestSuiteName) + if s.T() != nil && s.T().Name() != "" { + testName := s.T().Name() + + // Handle case where test name includes slash (TestSuiteName/TestMethodName) + parts := strings.Split(testName, "/") + if len(parts) > 0 { + suiteName := strings.TrimPrefix(parts[0], "Test") + if suiteName != "" { + return suiteName + } + } + } + + // Fallback to a generic name + return "InterchainTestSuite" } func (s *Suite) GetContext() context.Context {