Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(e2e): Add verbose logging to integration tests (#3580) #3584

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
52 changes: 46 additions & 6 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package e2e

import "fmt"
import (
"fmt"
"testing"
)

var (
runBankTest = true
Expand All @@ -20,125 +23,162 @@
runWasmLightClientTest = true
)

// logTestStart logs when a test starts
func logTestStart(testName string) {
fmt.Printf("▶️ Starting test: %s...\n", testName)
}

// logTestResult logs the result of a test
func logTestResult(t *testing.T, testName string) {
if t.Failed() {
fmt.Printf("❌ Test FAILED: %s\n", testName)
} else {
fmt.Printf("✅ Test PASSED: %s\n", testName)
}
}

func (s *IntegrationTestSuite) TestRestInterfaces() {
if !runRestInterfacesTest {
s.T().Skip()
}
logTestStart("Rest Interfaces")
s.testRestInterfaces()
logTestResult("Rest Interfaces", s.T())

Check failure on line 46 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

cannot use "Rest Interfaces" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 46 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult

Check failure on line 46 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

cannot use "Rest Interfaces" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 46 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult

Check failure on line 46 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

cannot use "Rest Interfaces" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 46 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult
}

func (s *IntegrationTestSuite) TestBank() {
if !runBankTest {
s.T().Skip()
}
logTestStart("Bank Token Transfer")
s.testBankTokenTransfer()
logTestResult("Bank Token Transfer", s.T())

Check failure on line 55 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

cannot use "Bank Token Transfer" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 55 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult

Check failure on line 55 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

cannot use "Bank Token Transfer" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 55 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult

Check failure on line 55 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

cannot use "Bank Token Transfer" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 55 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult
}

func (s *IntegrationTestSuite) TestEncode() {
if !runEncodeTest {
s.T().Skip()
}
logTestStart("Encoding")
s.testEncode()
s.testDecode()
logTestResult("Encoding", s.T())

Check failure on line 65 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

cannot use "Encoding" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 65 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult

Check failure on line 65 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

cannot use "Encoding" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 65 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult

Check failure on line 65 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

cannot use "Encoding" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 65 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult
}

func (s *IntegrationTestSuite) TestEvidence() {
if !runEvidenceTest {
s.T().Skip()
}
logTestStart("Evidence Handling")
s.testEvidence()
logTestResult("Evidence Handling", s.T())

Check failure on line 74 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

cannot use "Evidence Handling" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 74 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult

Check failure on line 74 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

cannot use "Evidence Handling" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 74 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult

Check failure on line 74 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

cannot use "Evidence Handling" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 74 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult
}

func (s *IntegrationTestSuite) TestFeeGrant() {
if !runFeeGrantTest {
s.T().Skip()
}
logTestStart("Fee Grant")
s.testFeeGrant()
logTestResult("Fee Grant", s.T())

Check failure on line 83 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

cannot use "Fee Grant" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 83 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult

Check failure on line 83 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

cannot use "Fee Grant" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 83 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / Analyze

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult

Check failure on line 83 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

cannot use "Fee Grant" (untyped string constant) as *"testing".T value in argument to logTestResult

Check failure on line 83 in tests/e2e/e2e_test.go

View workflow job for this annotation

GitHub Actions / test-e2e

cannot use s.T() (value of type *"testing".T) as string value in argument to logTestResult
}

func (s *IntegrationTestSuite) TestGov() {
if !runGovTest {
s.T().Skip()
}

logTestStart("Governance")
s.GovCancelSoftwareUpgrade()
s.GovCommunityPoolSpend()

s.testSetBlocksPerEpoch()
s.ExpeditedProposalRejected()
s.GovSoftwareUpgradeExpedited()
logTestResult("Governance", s.T())
}

func (s *IntegrationTestSuite) TestIBC() {
if !runIBCTest {
s.T().Skip()
}

logTestStart("IBC Transfer")
s.testIBCTokenTransfer()
s.testMultihopIBCTokenTransfer()
s.testFailedMultihopIBCTokenTransfer()
s.testICARegisterAccountAndSendTx()
logTestResult("IBC Transfer", s.T())
}

func (s *IntegrationTestSuite) TestSlashing() {
if !runSlashingTest {
s.T().Skip()
}
logTestStart("Slashing")
chainAPI := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
s.testSlashing(chainAPI)
logTestResult("Slashing", s.T())
}

// todo add fee test with wrong denom order
func (s *IntegrationTestSuite) TestStakingAndDistribution() {
if !runStakingAndDistributionTest {
s.T().Skip()
}
logTestStart("Staking & Distribution")
s.testStaking()
s.testDistribution()
logTestResult("Staking & Distribution", s.T())
}

func (s *IntegrationTestSuite) TestVesting() {
if !runVestingTest {
s.T().Skip()
}
logTestStart("Vesting Accounts")
chainAAPI := fmt.Sprintf("http://%s", s.valResources[s.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.
logTestResult("Vesting Accounts", s.T())
}

func (s *IntegrationTestSuite) TestLSM() {
if !runLsmTest {
s.T().Skip()
}
logTestStart("Liquid Staking Module (LSM)")
s.testLSM()
logTestResult("Liquid Staking Module (LSM)", s.T())
}

func (s *IntegrationTestSuite) TestRateLimit() {
if !runRateLimitTest {
s.T().Skip()
}
logTestStart("Rate Limit")
s.testAddRateLimits()
s.testIBCTransfer(true)
s.testUpdateRateLimit()
s.testIBCTransfer(false)
s.testResetRateLimit()
s.testRemoveRateLimit()
logTestResult("Rate Limit", s.T())
}

func (s *IntegrationTestSuite) TestTxExtensions() {
if !runTxExtensionsTest {
s.T().Skip()
}
logTestStart("Transaction Extensions")
s.bankSendWithNonCriticalExtensionOptions()
s.failedBankSendWithNonCriticalExtensionOptions()
logTestResult("Transaction Extensions", s.T())
}

func (s *IntegrationTestSuite) TestCW() {
if !runCWTest {
s.T().Skip()
}
logTestStart("CosmWasm Tests")
s.testCWCounter()
logTestResult("CosmWasm Tests", s.T())
}

func (s *IntegrationTestSuite) TestWasmLightClient() {
Expand Down
Loading