From 2db9b0ea095f818289af330db2d4f2ca81753bf5 Mon Sep 17 00:00:00 2001 From: Nina Barbakadze Date: Thu, 11 Apr 2024 17:53:01 +0200 Subject: [PATCH 01/11] refactor: switch e2e tests to a binary --- .../{upgrade_test.go => check_upgrades.go} | 148 +++++++++++------- test/e2e/main.go | 50 ++++++ test/e2e/{ => pkg}/defaults.go | 4 +- test/e2e/{ => pkg}/node.go | 2 +- test/e2e/{ => pkg}/readme.md | 1 - test/e2e/{ => pkg}/setup.go | 2 +- test/e2e/{ => pkg}/testnet.go | 2 +- test/e2e/{ => pkg}/txsimNode.go | 2 +- test/e2e/{ => pkg}/util.go | 2 +- test/e2e/{ => pkg}/versions.go | 11 +- test/e2e/{ => pkg}/versions_test.go | 32 ++-- test/e2e/{simple_test.go => simple.go} | 67 ++++---- test/e2e/throughput_test.go | 85 ---------- 13 files changed, 209 insertions(+), 199 deletions(-) rename test/e2e/{upgrade_test.go => check_upgrades.go} (60%) create mode 100644 test/e2e/main.go rename test/e2e/{ => pkg}/defaults.go (68%) rename test/e2e/{ => pkg}/node.go (99%) rename test/e2e/{ => pkg}/readme.md (90%) rename test/e2e/{ => pkg}/setup.go (99%) rename test/e2e/{ => pkg}/testnet.go (99%) rename test/e2e/{ => pkg}/txsimNode.go (99%) rename test/e2e/{ => pkg}/util.go (99%) rename test/e2e/{ => pkg}/versions.go (88%) rename test/e2e/{ => pkg}/versions_test.go (50%) rename test/e2e/{simple_test.go => simple.go} (53%) delete mode 100644 test/e2e/throughput_test.go diff --git a/test/e2e/upgrade_test.go b/test/e2e/check_upgrades.go similarity index 60% rename from test/e2e/upgrade_test.go rename to test/e2e/check_upgrades.go index d23c935aed..88795784f5 100644 --- a/test/e2e/upgrade_test.go +++ b/test/e2e/check_upgrades.go @@ -1,74 +1,77 @@ -package e2e +package main import ( "context" "errors" "fmt" + "log" "math/rand" "os" "strings" - "testing" "time" "github.com/celestiaorg/celestia-app/v2/app" "github.com/celestiaorg/celestia-app/v2/app/encoding" v1 "github.com/celestiaorg/celestia-app/v2/pkg/appconsts/v1" v2 "github.com/celestiaorg/celestia-app/v2/pkg/appconsts/v2" + "github.com/celestiaorg/celestia-app/v2/test/e2e/pkg" "github.com/celestiaorg/celestia-app/v2/test/txsim" "github.com/celestiaorg/knuu/pkg/knuu" - "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/rpc/client/http" ) -// This will only run tests within the v1 major release cycle -const MajorVersion = v1.Version - -func TestMinorVersionCompatibility(t *testing.T) { - // FIXME: This test currently panics in InitGenesis - t.Skip("test not working") +func MinorVersionCompatibility(logger *log.Logger) error { if os.Getenv("KNUU_NAMESPACE") != "test" { - t.Skip("skipping e2e test") + logger.Fatal("skipping e2e test") } if os.Getenv("E2E_VERSIONS") == "" { - t.Skip("skipping e2e test: E2E_VERSIONS not set") + logger.Fatal("skipping e2e test: E2E_VERSIONS not set") } versionStr := os.Getenv("E2E_VERSIONS") - versions := ParseVersions(versionStr).FilterMajor(MajorVersion).FilterOutReleaseCandidates() + versions := pkg.ParseVersions(versionStr).FilterMajor(MajorVersion).FilterOutReleaseCandidates() + fmt.Println("versions", len(versions)) if len(versions) == 0 { - t.Skip("skipping e2e test: no versions to test") + logger.Fatal("skipping e2e test: no versions to test") } numNodes := 4 r := rand.New(rand.NewSource(seed)) - t.Log("Running minor version compatibility test", "versions", versions) + logger.Println("Running minor version compatibility test", "versions", versions) - testnet, err := New(t.Name(), seed, GetGrafanaInfoFromEnvVar()) - require.NoError(t, err) - t.Cleanup(testnet.Cleanup) + testnet, err := pkg.New("runMinorVersionCompatibility", seed, pkg.GetGrafanaInfoFromEnvVar()) + if err != nil { + return err + } + defer testnet.Cleanup() testnet.SetConsensusParams(app.DefaultInitialConsensusParams()) // preload all docker images preloader, err := knuu.NewPreloader() - require.NoError(t, err) - t.Cleanup(func() { _ = preloader.EmptyImages() }) + if err != nil { + return err + } + defer func() { _ = preloader.EmptyImages() }() for _, v := range versions { - err := preloader.AddImage(DockerImageName(v.String())) - require.NoError(t, err) + err := preloader.AddImage(pkg.DockerImageName(v.String())) + NoError("failed to add image", err) } for i := 0; i < numNodes; i++ { // each node begins with a random version within the same major version set v := versions.Random(r).String() - t.Log("Starting node", "node", i, "version", v) - require.NoError(t, testnet.CreateGenesisNode(v, 10000000, 0, defaultResources)) + fmt.Println("Starting node", "node", i, "version", v) + err := testnet.CreateGenesisNode(v, 10000000, 0, pkg.DefaultResources) + NoError("failed to create genesis node", err) } kr, err := testnet.CreateAccount("alice", 1e12, "") - require.NoError(t, err) + NoError("failed to create account", err) - require.NoError(t, testnet.Setup()) - require.NoError(t, testnet.Start()) + err = testnet.Start() + NoError("failed to start testnet", err) + err = testnet.Start() + NoError("failed to start testnet", err) // TODO: with upgrade tests we should simulate a far broader range of transactions sequences := txsim.NewBlobSequence(txsim.NewRange(200, 4000), txsim.NewRange(1, 3)).Clone(5) @@ -90,33 +93,40 @@ func TestMinorVersionCompatibility(t *testing.T) { continue } client, err := testnet.Node(i % numNodes).Client() - require.NoError(t, err) + if err != nil { + return err + } heightBefore, err := getHeight(ctx, client, time.Second) - require.NoError(t, err) + NoError("failed to get height", err) + newVersion := versions.Random(r).String() - t.Log("Upgrading node", "node", i%numNodes, "version", newVersion) + logger.Println("Upgrading node", "node", i%numNodes, "version", newVersion) err = testnet.Node(i % numNodes).Upgrade(newVersion) - require.NoError(t, err) + NoError("failed to upgrade node", err) // wait for the node to reach two more heights err = waitForHeight(ctx, client, heightBefore+2, 30*time.Second) - require.NoError(t, err) + NoError("failed to wait for height", err) } heights := make([]int64, 4) for i := 0; i < numNodes; i++ { client, err := testnet.Node(i).Client() - require.NoError(t, err) + if err != nil { + return err + } heights[i], err = getHeight(ctx, client, time.Second) - require.NoError(t, err) + if err != nil { + return err + } } - t.Log("checking that all nodes are at the same height") + logger.Println("checking that all nodes are at the same height") const maxPermissableDiff = 2 for i := 0; i < len(heights); i++ { for j := i + 1; j < len(heights); j++ { diff := heights[i] - heights[j] if diff > maxPermissableDiff { - t.Fatalf("node %d is behind node %d by %d blocks", j, i, diff) + logger.Fatal("node %d is behind node %d by %d blocks", j, i, diff) } } } @@ -125,17 +135,21 @@ func TestMinorVersionCompatibility(t *testing.T) { cancel() err = <-errCh - require.True(t, errors.Is(err, context.Canceled), err.Error()) + + if !errors.Is(err, context.Canceled) { + return fmt.Errorf("expected context.Canceled error, got: %w", err) + } + return nil } -func TestMajorUpgradeToV2(t *testing.T) { +func MajorUpgradeToV2(logger *log.Logger) error { if os.Getenv("KNUU_NAMESPACE") != "test" { - t.Skip("skipping e2e test") + logger.Fatal("skipping e2e test") } if os.Getenv("E2E_LATEST_VERSION") != "" { latestVersion = os.Getenv("E2E_LATEST_VERSION") - _, isSemVer := ParseVersion(latestVersion) + _, isSemVer := pkg.ParseVersion(latestVersion) switch { case isSemVer: case latestVersion == "latest": @@ -144,7 +158,7 @@ func TestMajorUpgradeToV2(t *testing.T) { // assume this is a git commit hash (we need to trim the last digit to match the docker image tag) latestVersion = latestVersion[:7] default: - t.Fatalf("unrecognised version: %s", latestVersion) + logger.Fatalf("unrecognised version: %s", latestVersion) } } @@ -153,26 +167,31 @@ func TestMajorUpgradeToV2(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - testnet, err := New(t.Name(), seed, GetGrafanaInfoFromEnvVar()) - require.NoError(t, err) - t.Cleanup(testnet.Cleanup) + testnet, err := pkg.New("runMajorUpgradeToV2", seed, pkg.GetGrafanaInfoFromEnvVar()) + NoError("failed to create testnet", err) + + defer testnet.Cleanup() preloader, err := knuu.NewPreloader() - require.NoError(t, err) - t.Cleanup(func() { _ = preloader.EmptyImages() }) - err = preloader.AddImage(DockerImageName(latestVersion)) - require.NoError(t, err) + NoError("failed to create preloader", err) + + defer func() { _ = preloader.EmptyImages() }() + err = preloader.AddImage(pkg.DockerImageName(latestVersion)) + NoError("failed to add image", err) for i := 0; i < numNodes; i++ { - require.NoError(t, testnet.CreateGenesisNode(latestVersion, 10000000, - upgradeHeight, defaultResources)) + err := testnet.CreateGenesisNode(latestVersion, 10000000, upgradeHeight, pkg.DefaultResources) + NoError("failed to create genesis node", err) } kr, err := testnet.CreateAccount("alice", 1e12, "") - require.NoError(t, err) + NoError("failed to create account", err) + + err = testnet.Setup() + NoError("failed to setup testnet", err) - require.NoError(t, testnet.Setup()) - require.NoError(t, testnet.Start()) + err = testnet.Start() + NoError("failed to start testnet", err) errCh := make(chan error) encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) @@ -187,21 +206,32 @@ func TestMajorUpgradeToV2(t *testing.T) { heightBefore := upgradeHeight - 1 for i := 0; i < numNodes; i++ { client, err := testnet.Node(i).Client() - require.NoError(t, err) - require.NoError(t, waitForHeight(ctx, client, upgradeHeight, time.Minute)) + NoError("failed to get client", err) + + err = waitForHeight(ctx, client, upgradeHeight, time.Minute) + NoError("failed to wait for height", err) + resp, err := client.Header(ctx, &heightBefore) - require.NoError(t, err) - require.Equal(t, v1.Version, resp.Header.Version.App, "version mismatch before upgrade") + NoError("failed to get header", err) + if resp.Header.Version.App != v1.Version { + return fmt.Errorf("version mismatch before upgrade: expected %d, got %d", v1.Version, resp.Header.Version.App) + } + resp, err = client.Header(ctx, &upgradeHeight) - require.NoError(t, err) - require.Equal(t, v2.Version, resp.Header.Version.App, "version mismatch after upgrade") + NoError("failed to get header", err) + if resp.Header.Version.App != v2.Version { + return fmt.Errorf("version mismatch before upgrade: expected %d, got %d", v2.Version, resp.Header.Version.App) + } } // end txsim cancel() err = <-errCh - require.True(t, strings.Contains(err.Error(), context.Canceled.Error()), err.Error()) + if !strings.Contains(err.Error(), context.Canceled.Error()) { + return fmt.Errorf("expected context.Canceled error, got: %w", err) + } + return nil } func getHeight(ctx context.Context, client *http.HTTP, period time.Duration) (int64, error) { diff --git a/test/e2e/main.go b/test/e2e/main.go new file mode 100644 index 0000000000..aad232f9df --- /dev/null +++ b/test/e2e/main.go @@ -0,0 +1,50 @@ +package main + +import ( + "fmt" + "log" + "os" + + v1 "github.com/celestiaorg/celestia-app/v2/pkg/appconsts/v1" +) + +// This will only run tests within the v1 major release cycle +const ( + MajorVersion = v1.Version + seed = 42 +) + +var latestVersion = "latest" + +func main() { + logger := log.New(os.Stdout, "test", log.LstdFlags) + // FIXME: This test currently panics in InitGenesis + // it's currently not running + if os.Getenv("RUN_MINOR_VERSION_COMPATIBILITY") == "true" { + logger.Println("Running minor version compatibility test") + err := MinorVersionCompatibility(logger) + if err != nil { + logger.Fatalf("Error running minor version compatibility: %v", err) + } + } + + logger.Println("====== Running major upgrade to v2 e2e test ======") + // err := MajorUpgradeToV2(logger) + // if err != nil { + // logger.Fatalf("Error running minor version compatibility: %v", err) + // } + + logger.Println("====== Running simple e2e test ======") + err := E2ESimple(logger) + if err != nil { + logger.Fatalf("Error running simple e2e test: %v", err) + } +} + +// helper function to wrap errors +func NoError(message string, err error) error { + if err != nil { + return fmt.Errorf("%s: %w", message, err) + } + return nil +} diff --git a/test/e2e/defaults.go b/test/e2e/pkg/defaults.go similarity index 68% rename from test/e2e/defaults.go rename to test/e2e/pkg/defaults.go index 41681f12ca..fb531b7b56 100644 --- a/test/e2e/defaults.go +++ b/test/e2e/pkg/defaults.go @@ -1,6 +1,6 @@ -package e2e +package pkg -var defaultResources = Resources{ +var DefaultResources = Resources{ MemoryRequest: "200Mi", MemoryLimit: "200Mi", CPU: "300m", diff --git a/test/e2e/node.go b/test/e2e/pkg/node.go similarity index 99% rename from test/e2e/node.go rename to test/e2e/pkg/node.go index 61388ff167..6080d1f4d3 100644 --- a/test/e2e/node.go +++ b/test/e2e/pkg/node.go @@ -1,4 +1,4 @@ -package e2e +package pkg import ( "fmt" diff --git a/test/e2e/readme.md b/test/e2e/pkg/readme.md similarity index 90% rename from test/e2e/readme.md rename to test/e2e/pkg/readme.md index a20e942998..150f25271c 100644 --- a/test/e2e/readme.md +++ b/test/e2e/pkg/readme.md @@ -6,7 +6,6 @@ End to end tests pull docker images from ghcr.io/celestiaorg/celestia-app. These ## Usage -E2E tests can be simply run through go tests. They are distinguished from unit tests through an environment variable. To run all e2e tests run: ```shell KNUU_NAMESPACE=test E2E_LATEST_VERSION="$(git rev-parse --short main)" E2E_VERSIONS="$(git tag -l)" go test ./test/e2e/... -timeout 30m -v diff --git a/test/e2e/setup.go b/test/e2e/pkg/setup.go similarity index 99% rename from test/e2e/setup.go rename to test/e2e/pkg/setup.go index 810fd3dc71..70cc635962 100644 --- a/test/e2e/setup.go +++ b/test/e2e/pkg/setup.go @@ -1,4 +1,4 @@ -package e2e +package pkg import ( "fmt" diff --git a/test/e2e/testnet.go b/test/e2e/pkg/testnet.go similarity index 99% rename from test/e2e/testnet.go rename to test/e2e/pkg/testnet.go index 25c3926082..ce260cb24b 100644 --- a/test/e2e/testnet.go +++ b/test/e2e/pkg/testnet.go @@ -1,4 +1,4 @@ -package e2e +package pkg import ( "context" diff --git a/test/e2e/txsimNode.go b/test/e2e/pkg/txsimNode.go similarity index 99% rename from test/e2e/txsimNode.go rename to test/e2e/pkg/txsimNode.go index 971aafb67e..b70a21cd51 100644 --- a/test/e2e/txsimNode.go +++ b/test/e2e/pkg/txsimNode.go @@ -1,4 +1,4 @@ -package e2e +package pkg import ( "fmt" diff --git a/test/e2e/util.go b/test/e2e/pkg/util.go similarity index 99% rename from test/e2e/util.go rename to test/e2e/pkg/util.go index 5bf3bbcb7f..25a5bb61bd 100644 --- a/test/e2e/util.go +++ b/test/e2e/pkg/util.go @@ -1,4 +1,4 @@ -package e2e +package pkg import ( "io" diff --git a/test/e2e/versions.go b/test/e2e/pkg/versions.go similarity index 88% rename from test/e2e/versions.go rename to test/e2e/pkg/versions.go index 51e0f5c329..3a34a67628 100644 --- a/test/e2e/versions.go +++ b/test/e2e/pkg/versions.go @@ -1,4 +1,4 @@ -package e2e +package pkg import ( "fmt" @@ -45,6 +45,7 @@ type VersionSet []Version func ParseVersions(versionStr string) VersionSet { versions := strings.Split(versionStr, " ") output := make(VersionSet, 0, len(versions)) + fmt.Println(versions, "VERSIONSSS") for _, v := range versions { version, isValid := ParseVersion(v) if !isValid { @@ -52,6 +53,7 @@ func ParseVersions(versionStr string) VersionSet { } output = append(output, version) } + fmt.Println(output, "output") return output } @@ -59,12 +61,16 @@ func ParseVersions(versionStr string) VersionSet { // valid version, the second return value is false. // Must be of the format v1.0.0 or v1.0.0-rc1 (i.e. following SemVer) func ParseVersion(version string) (Version, bool) { + fmt.Println(version, "VERSION in parse v ersion") var major, minor, patch, rc uint64 isRC := false if strings.Contains(version, "rc") { + fmt.Println("HERE") _, err := fmt.Sscanf(version, "v%d.%d.%d-rc%d", &major, &minor, &patch, &rc) isRC = true if err != nil { + fmt.Println(err, "ERROR", version) + fmt.Println("HERE 2") return Version{}, false } } else { @@ -73,6 +79,7 @@ func ParseVersion(version string) (Version, bool) { return Version{}, false } } + fmt.Println(Version{major, minor, patch, isRC, rc}, true, "PARSE VERSION") return Version{major, minor, patch, isRC, rc}, true } @@ -83,6 +90,7 @@ func (v VersionSet) FilterMajor(majorVersion uint64) VersionSet { output = append(output, version) } } + fmt.Println(output, "output") return output } @@ -90,6 +98,7 @@ func (v VersionSet) FilterOutReleaseCandidates() VersionSet { output := make(VersionSet, 0, len(v)) for _, version := range v { if version.IsRC { + fmt.Println("skipping version", version.String()) continue } output = append(output, version) diff --git a/test/e2e/versions_test.go b/test/e2e/pkg/versions_test.go similarity index 50% rename from test/e2e/versions_test.go rename to test/e2e/pkg/versions_test.go index 605c5c5623..4b09d7cc34 100644 --- a/test/e2e/versions_test.go +++ b/test/e2e/pkg/versions_test.go @@ -1,24 +1,24 @@ -package e2e_test +package pkg_test import ( "testing" - "github.com/celestiaorg/celestia-app/v2/test/e2e" + "github.com/celestiaorg/celestia-app/v2/test/e2e/pkg" "github.com/stretchr/testify/require" ) func TestVersionParsing(t *testing.T) { versionStr := "v1.3.0 v1.1.0 v1.2.0-rc0" - versions := e2e.ParseVersions(versionStr) + versions := pkg.ParseVersions(versionStr) require.Len(t, versions, 3) require.Len(t, versions.FilterOutReleaseCandidates(), 2) - require.Equal(t, versions.GetLatest(), e2e.Version{1, 3, 0, false, 0}) + require.Equal(t, versions.GetLatest(), pkg.Version{1, 3, 0, false, 0}) } // Test case with multiple major versions and filtering out a single major version func TestFilterMajorVersions(t *testing.T) { versionStr := "v2.0.0 v1.1.0 v2.1.0-rc0 v1.2.0 v2.2.0 v1.3.0" - versions := e2e.ParseVersions(versionStr) + versions := pkg.ParseVersions(versionStr) require.Len(t, versions, 6) require.Len(t, versions.FilterMajor(1), 3) } @@ -26,14 +26,14 @@ func TestFilterMajorVersions(t *testing.T) { // Test case to check the Order function func TestOrder(t *testing.T) { versionStr := "v1.3.0 v1.1.0 v1.2.0-rc0 v1.4.0 v1.2.1 v2.0.0" - versions := e2e.ParseVersions(versionStr) + versions := pkg.ParseVersions(versionStr) versions.Order() - require.Equal(t, versions[0], e2e.Version{1, 1, 0, false, 0}) - require.Equal(t, versions[1], e2e.Version{1, 2, 0, true, 0}) - require.Equal(t, versions[2], e2e.Version{1, 2, 1, false, 0}) - require.Equal(t, versions[3], e2e.Version{1, 3, 0, false, 0}) - require.Equal(t, versions[4], e2e.Version{1, 4, 0, false, 0}) - require.Equal(t, versions[5], e2e.Version{2, 0, 0, false, 0}) + require.Equal(t, versions[0], pkg.Version{1, 1, 0, false, 0}) + require.Equal(t, versions[1], pkg.Version{1, 2, 0, true, 0}) + require.Equal(t, versions[2], pkg.Version{1, 2, 1, false, 0}) + require.Equal(t, versions[3], pkg.Version{1, 3, 0, false, 0}) + require.Equal(t, versions[4], pkg.Version{1, 4, 0, false, 0}) + require.Equal(t, versions[5], pkg.Version{2, 0, 0, false, 0}) for i := len(versions) - 1; i > 0; i-- { require.True(t, versions[i].IsGreater(versions[i-1])) } @@ -41,9 +41,9 @@ func TestOrder(t *testing.T) { func TestOrderOfReleaseCandidates(t *testing.T) { versionsStr := "v1.0.0 v1.0.0-rc0 v1.0.0-rc1" - versions := e2e.ParseVersions(versionsStr) + versions := pkg.ParseVersions(versionsStr) versions.Order() - require.Equal(t, versions[0], e2e.Version{1, 0, 0, true, 0}) - require.Equal(t, versions[1], e2e.Version{1, 0, 0, true, 1}) - require.Equal(t, versions[2], e2e.Version{1, 0, 0, false, 0}) + require.Equal(t, versions[0], pkg.Version{1, 0, 0, true, 0}) + require.Equal(t, versions[1], pkg.Version{1, 0, 0, true, 1}) + require.Equal(t, versions[2], pkg.Version{1, 0, 0, false, 0}) } diff --git a/test/e2e/simple_test.go b/test/e2e/simple.go similarity index 53% rename from test/e2e/simple_test.go rename to test/e2e/simple.go index b8a8c53be7..8730450e15 100644 --- a/test/e2e/simple_test.go +++ b/test/e2e/simple.go @@ -1,35 +1,31 @@ -package e2e +package main import ( "context" "errors" + "log" "os" - "testing" "time" "github.com/celestiaorg/celestia-app/v2/app" "github.com/celestiaorg/celestia-app/v2/app/encoding" "github.com/celestiaorg/celestia-app/v2/pkg/appconsts" + "github.com/celestiaorg/celestia-app/v2/test/e2e/pkg" "github.com/celestiaorg/celestia-app/v2/test/txsim" "github.com/celestiaorg/celestia-app/v2/test/util/testnode" - "github.com/stretchr/testify/require" ) -const seed = 42 - -var latestVersion = "latest" - // This test runs a simple testnet with 4 validators. It submits both MsgPayForBlobs // and MsgSends over 30 seconds and then asserts that at least 10 transactions were // committed. -func TestE2ESimple(t *testing.T) { +func E2ESimple(logger *log.Logger) error { if os.Getenv("KNUU_NAMESPACE") != "test" { - t.Skip("skipping e2e test") + logger.Fatal("skipping e2e test") } if os.Getenv("E2E_LATEST_VERSION") != "" { latestVersion = os.Getenv("E2E_LATEST_VERSION") - _, isSemVer := ParseVersion(latestVersion) + _, isSemVer := pkg.ParseVersion(latestVersion) switch { case isSemVer: case latestVersion == "latest": @@ -38,29 +34,32 @@ func TestE2ESimple(t *testing.T) { // assume this is a git commit hash (we need to trim the last digit to match the docker image tag) latestVersion = latestVersion[:7] default: - t.Fatalf("unrecognised version: %s", latestVersion) + logger.Fatalf("unrecognised version: %s", latestVersion) } } - t.Log("Running simple e2e test", "version", latestVersion) + logger.Println("Running simple e2e test", "version", latestVersion) - testnet, err := New(t.Name(), seed, GetGrafanaInfoFromEnvVar()) - require.NoError(t, err) - t.Cleanup(testnet.Cleanup) + testnet, err := pkg.New("E2ESimple", seed, pkg.GetGrafanaInfoFromEnvVar()) + NoError("failed to create testnet", err) + defer testnet.Cleanup() - t.Log("Creating testnet validators") - require.NoError(t, testnet.CreateGenesisNodes(4, latestVersion, 10000000, - 0, defaultResources)) + logger.Println("Creating testnet validators") + err = testnet.CreateGenesisNodes(4, latestVersion, 10000000, 0, pkg.DefaultResources) + NoError("failed to create genesis nodes", err) - t.Log("Creating account") + logger.Println("Creating account") kr, err := testnet.CreateAccount("alice", 1e12, "") - require.NoError(t, err) + NoError("failed to create account", err) - t.Log("Setting up testnet") - require.NoError(t, testnet.Setup()) - t.Log("Starting testnet") - require.NoError(t, testnet.Start()) + logger.Println("Setting up testnet") + err = testnet.Setup() + NoError("failed to setup testnet", err) - t.Log("Running txsim") + logger.Println("Starting testnet") + err = testnet.Start() + NoError("failed to start testnet", err) + + logger.Println("Running txsim") sequences := txsim.NewBlobSequence(txsim.NewRange(200, 4000), txsim.NewRange(1, 3)).Clone(5) sequences = append(sequences, txsim.NewSendSequence(4, 1000, 100).Clone(5)...) @@ -69,16 +68,24 @@ func TestE2ESimple(t *testing.T) { defer cancel() opts := txsim.DefaultOptions().WithSeed(seed).SuppressLogs() err = txsim.Run(ctx, testnet.GRPCEndpoints()[0], kr, encCfg, opts, sequences...) - require.True(t, errors.Is(err, context.DeadlineExceeded), err.Error()) - t.Log("Reading blockchain") + if !errors.Is(err, context.DeadlineExceeded) { + logger.Fatal("Expected context.DeadlineExceeded, got %v", err) + } + + logger.Println("Reading blockchain") blockchain, err := testnode.ReadBlockchain(context.Background(), testnet.Node(0).AddressRPC()) - require.NoError(t, err) + NoError("failed to read blockchain", err) totalTxs := 0 for _, block := range blockchain { - require.Equal(t, appconsts.LatestVersion, block.Version.App) + if appconsts.LatestVersion != block.Version.App { + logger.Fatalf("expected app version %s, got %s", appconsts.LatestVersion, block.Version.App) + } totalTxs += len(block.Data.Txs) } - require.Greater(t, totalTxs, 10) + if totalTxs < 10 { + logger.Fatalf("expected at least 10 transactions, got %d", totalTxs) + } + return nil } diff --git a/test/e2e/throughput_test.go b/test/e2e/throughput_test.go deleted file mode 100644 index 16848d1042..0000000000 --- a/test/e2e/throughput_test.go +++ /dev/null @@ -1,85 +0,0 @@ -package e2e - -import ( - "context" - "os" - "testing" - "time" - - "github.com/celestiaorg/celestia-app/v2/pkg/appconsts" - "github.com/celestiaorg/celestia-app/v2/test/util/testnode" - "github.com/stretchr/testify/require" -) - -func TestE2EThroughput(t *testing.T) { - if os.Getenv("KNUU_NAMESPACE") != "test" { - t.Skip("skipping e2e throughput test") - } - - if os.Getenv("E2E_LATEST_VERSION") != "" { - latestVersion = os.Getenv("E2E_LATEST_VERSION") - _, isSemVer := ParseVersion(latestVersion) - switch { - case isSemVer: - case latestVersion == "latest": - case len(latestVersion) == 7: - case len(latestVersion) >= 8: - // assume this is a git commit hash (we need to trim the last digit to match the docker image tag) - latestVersion = latestVersion[:7] - default: - t.Fatalf("unrecognised version: %s", latestVersion) - } - } - - t.Log("Running throughput test", "version", latestVersion) - - // create a new testnet - testnet, err := New(t.Name(), seed, GetGrafanaInfoFromEnvVar()) - require.NoError(t, err) - t.Cleanup(func() { - t.Log("Cleaning up testnet") - testnet.Cleanup() - }) - - // add 2 validators - require.NoError(t, testnet.CreateGenesisNodes(2, latestVersion, 10000000, - 0, defaultResources)) - - // obtain the GRPC endpoints of the validators - gRPCEndpoints, err := testnet.RemoteGRPCEndpoints() - require.NoError(t, err) - t.Log("validators GRPC endpoints", gRPCEndpoints) - - // create txsim nodes and point them to the validators - t.Log("Creating txsim nodes") - // version of the txsim docker image to be used - txsimVersion := "a92de72" - - err = testnet.CreateTxClients(txsimVersion, 1, "10000-10000", defaultResources, gRPCEndpoints) - require.NoError(t, err) - - // start the testnet - t.Log("Setting up testnet") - require.NoError(t, testnet.Setup()) // configs, genesis files, etc. - t.Log("Starting testnet") - require.NoError(t, testnet.Start()) - - // once the testnet is up, start the txsim - t.Log("Starting txsim nodes") - err = testnet.StartTxClients() - require.NoError(t, err) - - // wait some time for the txsim to submit transactions - time.Sleep(1 * time.Minute) - - t.Log("Reading blockchain") - blockchain, err := testnode.ReadBlockchain(context.Background(), testnet.Node(0).AddressRPC()) - require.NoError(t, err) - - totalTxs := 0 - for _, block := range blockchain { - require.Equal(t, appconsts.LatestVersion, block.Version.App) - totalTxs += len(block.Data.Txs) - } - require.Greater(t, totalTxs, 10) -} From 2d38595132c6c32fa7899a3966f95441eb39fe4e Mon Sep 17 00:00:00 2001 From: Nina Barbakadze Date: Mon, 15 Apr 2024 17:23:01 +0200 Subject: [PATCH 02/11] works --- test/e2e/benchmark/throughput.go | 98 +++++++++++++++++++++++++ test/e2e/check_upgrades.go | 93 ++++++++++------------- test/e2e/main.go | 58 +++++++++------ test/e2e/pkg/versions_test.go | 49 ------------- test/e2e/simple.go | 39 +++++----- test/e2e/{pkg => testnets}/defaults.go | 2 +- test/e2e/{pkg => testnets}/node.go | 2 +- test/e2e/{pkg => testnets}/readme.md | 0 test/e2e/{pkg => testnets}/setup.go | 2 +- test/e2e/testnets/test_helpers.go | 11 +++ test/e2e/{pkg => testnets}/testnet.go | 2 +- test/e2e/{pkg => testnets}/txsimNode.go | 2 +- test/e2e/{pkg => testnets}/util.go | 2 +- test/e2e/{pkg => testnets}/versions.go | 3 +- test/e2e/testnets/versions_test.go | 49 +++++++++++++ 15 files changed, 261 insertions(+), 151 deletions(-) create mode 100644 test/e2e/benchmark/throughput.go delete mode 100644 test/e2e/pkg/versions_test.go rename test/e2e/{pkg => testnets}/defaults.go (88%) rename test/e2e/{pkg => testnets}/node.go (99%) rename test/e2e/{pkg => testnets}/readme.md (100%) rename test/e2e/{pkg => testnets}/setup.go (98%) create mode 100644 test/e2e/testnets/test_helpers.go rename test/e2e/{pkg => testnets}/testnet.go (99%) rename test/e2e/{pkg => testnets}/txsimNode.go (98%) rename test/e2e/{pkg => testnets}/util.go (98%) rename test/e2e/{pkg => testnets}/versions.go (98%) create mode 100644 test/e2e/testnets/versions_test.go diff --git a/test/e2e/benchmark/throughput.go b/test/e2e/benchmark/throughput.go new file mode 100644 index 0000000000..997f9c76f0 --- /dev/null +++ b/test/e2e/benchmark/throughput.go @@ -0,0 +1,98 @@ +package main + +import ( + "context" + "fmt" + "log" + "os" + "time" + + "github.com/celestiaorg/celestia-app/v2/pkg/appconsts" + "github.com/celestiaorg/celestia-app/v2/test/e2e/testnets" + "github.com/celestiaorg/celestia-app/v2/test/util/testnode" +) + +var latestVersion = "latest" + +const seed = 42 + +func main() { + if err := E2EThroughput(); err != nil { + log.Fatalf("--- ERROR Throughput test: %v", err.Error()) + } +} + +func E2EThroughput() error { + log.SetFlags(0) // Disable additional information like the date or time + log.SetPrefix(" ") + + if os.Getenv("E2E_LATEST_VERSION") != "" { + latestVersion = os.Getenv("E2E_LATEST_VERSION") + _, isSemVer := testnets.ParseVersion(latestVersion) + switch { + case isSemVer: + case latestVersion == "latest": + case len(latestVersion) == 7: + case len(latestVersion) >= 8: + // assume this is a git commit hash (we need to trim the last digit to match the docker image tag) + latestVersion = latestVersion[:7] + default: + return fmt.Errorf("unrecognised version %s", latestVersion) + } + } + + log.Println("=== RUN E2EThroughput", "version:", latestVersion) + + // create a new testnet + testnet, err := testnets.New("E2EThroughput", seed, testnets.GetGrafanaInfoFromEnvVar()) + testnets.NoError("failed to create testnet", err) + + log.Println("Cleaning up testnet") + defer testnet.Cleanup() + + // add 2 validators + testnets.NoError("failed to create genesis nodes", testnet.CreateGenesisNodes(2, latestVersion, 10000000, 0, testnets.DefaultResources)) + + // obtain the GRPC endpoints of the validators + gRPCEndpoints, err := testnet.RemoteGRPCEndpoints() + testnets.NoError("failed to get validators GRPC endpoints", err) + log.Println("validators GRPC endpoints", gRPCEndpoints) + + // create txsim nodes and point them to the validators + log.Println("Creating txsim nodes") + // version of the txsim docker image to be used + txsimVersion := "a92de72" + + err = testnet.CreateTxClients(txsimVersion, 1, "10000-10000", testnets.DefaultResources, gRPCEndpoints) + testnets.NoError("failed to create tx clients", err) + + // start the testnet + log.Println("Setting up testnet") + testnets.NoError("failed to setup testnet", testnet.Setup()) + log.Println("Starting testnet") + testnets.NoError("failed to start testnet", testnet.Start()) + + // once the testnet is up, start the txsim + log.Println("Starting txsim nodes") + testnets.NoError("failed to start tx clients", testnet.StartTxClients()) + + // wait some time for the txsim to submit transactions + time.Sleep(1 * time.Minute) + + log.Println("Reading blockchain") + blockchain, err := testnode.ReadBlockchain(context.Background(), testnet.Node(0).AddressRPC()) + testnets.NoError("failed to read blockchain", err) + + totalTxs := 0 + for _, block := range blockchain { + if appconsts.LatestVersion != block.Version.App { + return fmt.Errorf("expected app version %d, got %d", appconsts.LatestVersion, block.Version.App) + } + totalTxs += len(block.Data.Txs) + } + if totalTxs < 10 { + return fmt.Errorf("expected at least 10 transactions, got %d", totalTxs) + } + log.Println("--- PASS ✅: E2EThroughput") + return nil +} diff --git a/test/e2e/check_upgrades.go b/test/e2e/check_upgrades.go index 88795784f5..bf263cd700 100644 --- a/test/e2e/check_upgrades.go +++ b/test/e2e/check_upgrades.go @@ -14,7 +14,7 @@ import ( "github.com/celestiaorg/celestia-app/v2/app/encoding" v1 "github.com/celestiaorg/celestia-app/v2/pkg/appconsts/v1" v2 "github.com/celestiaorg/celestia-app/v2/pkg/appconsts/v2" - "github.com/celestiaorg/celestia-app/v2/test/e2e/pkg" + "github.com/celestiaorg/celestia-app/v2/test/e2e/testnets" "github.com/celestiaorg/celestia-app/v2/test/txsim" "github.com/celestiaorg/knuu/pkg/knuu" "github.com/tendermint/tendermint/rpc/client/http" @@ -22,7 +22,7 @@ import ( func MinorVersionCompatibility(logger *log.Logger) error { if os.Getenv("KNUU_NAMESPACE") != "test" { - logger.Fatal("skipping e2e test") + return fmt.Errorf("skipping e2e throughput test") } if os.Getenv("E2E_VERSIONS") == "" { @@ -30,8 +30,8 @@ func MinorVersionCompatibility(logger *log.Logger) error { } versionStr := os.Getenv("E2E_VERSIONS") - versions := pkg.ParseVersions(versionStr).FilterMajor(MajorVersion).FilterOutReleaseCandidates() - fmt.Println("versions", len(versions)) + versions := testnets.ParseVersions(versionStr).FilterMajor(MajorVersion).FilterOutReleaseCandidates() + if len(versions) == 0 { logger.Fatal("skipping e2e test: no versions to test") } @@ -39,39 +39,37 @@ func MinorVersionCompatibility(logger *log.Logger) error { r := rand.New(rand.NewSource(seed)) logger.Println("Running minor version compatibility test", "versions", versions) - testnet, err := pkg.New("runMinorVersionCompatibility", seed, pkg.GetGrafanaInfoFromEnvVar()) - if err != nil { - return err - } + testnet, err := testnets.New("runMinorVersionCompatibility", seed, testnets.GetGrafanaInfoFromEnvVar()) + testnets.NoError("failed to create testnet", err) + defer testnet.Cleanup() + testnet.SetConsensusParams(app.DefaultInitialConsensusParams()) // preload all docker images preloader, err := knuu.NewPreloader() - if err != nil { - return err - } + testnets.NoError("failed to create preloader", err) + defer func() { _ = preloader.EmptyImages() }() for _, v := range versions { - err := preloader.AddImage(pkg.DockerImageName(v.String())) - NoError("failed to add image", err) + testnets.NoError("failed to add image", preloader.AddImage(testnets.DockerImageName(v.String()))) } for i := 0; i < numNodes; i++ { // each node begins with a random version within the same major version set v := versions.Random(r).String() fmt.Println("Starting node", "node", i, "version", v) - err := testnet.CreateGenesisNode(v, 10000000, 0, pkg.DefaultResources) - NoError("failed to create genesis node", err) + testnets.NoError("failed to create genesis node", testnet.CreateGenesisNode(v, 10000000, 0, testnets.DefaultResources)) } kr, err := testnet.CreateAccount("alice", 1e12, "") - NoError("failed to create account", err) + testnets.NoError("failed to create account", err) - err = testnet.Start() - NoError("failed to start testnet", err) - err = testnet.Start() - NoError("failed to start testnet", err) + // start the testnet + fmt.Println("Setting up testnet") + testnets.NoError("Failed to setup testnet", testnet.Setup()) + fmt.Println("Starting testnet") + testnets.NoError("Failed to start testnet", testnet.Start()) // TODO: with upgrade tests we should simulate a far broader range of transactions sequences := txsim.NewBlobSequence(txsim.NewRange(200, 4000), txsim.NewRange(1, 3)).Clone(5) @@ -93,31 +91,24 @@ func MinorVersionCompatibility(logger *log.Logger) error { continue } client, err := testnet.Node(i % numNodes).Client() - if err != nil { - return err - } + testnets.NoError("failed to get client", err) + heightBefore, err := getHeight(ctx, client, time.Second) - NoError("failed to get height", err) + testnets.NoError("failed to get height", err) newVersion := versions.Random(r).String() logger.Println("Upgrading node", "node", i%numNodes, "version", newVersion) - err = testnet.Node(i % numNodes).Upgrade(newVersion) - NoError("failed to upgrade node", err) + testnets.NoError("failed to upgrade node", testnet.Node(i%numNodes).Upgrade(newVersion)) // wait for the node to reach two more heights - err = waitForHeight(ctx, client, heightBefore+2, 30*time.Second) - NoError("failed to wait for height", err) + testnets.NoError("failed to wait for height", waitForHeight(ctx, client, heightBefore+2, 30*time.Second)) } heights := make([]int64, 4) for i := 0; i < numNodes; i++ { client, err := testnet.Node(i).Client() - if err != nil { - return err - } + testnets.NoError("failed to get client", err) heights[i], err = getHeight(ctx, client, time.Second) - if err != nil { - return err - } + testnets.NoError("failed to get height", err) } logger.Println("checking that all nodes are at the same height") @@ -126,7 +117,7 @@ func MinorVersionCompatibility(logger *log.Logger) error { for j := i + 1; j < len(heights); j++ { diff := heights[i] - heights[j] if diff > maxPermissableDiff { - logger.Fatal("node %d is behind node %d by %d blocks", j, i, diff) + logger.Fatalf("node %d is behind node %d by %d blocks", j, i, diff) } } } @@ -149,7 +140,7 @@ func MajorUpgradeToV2(logger *log.Logger) error { if os.Getenv("E2E_LATEST_VERSION") != "" { latestVersion = os.Getenv("E2E_LATEST_VERSION") - _, isSemVer := pkg.ParseVersion(latestVersion) + _, isSemVer := testnets.ParseVersion(latestVersion) switch { case isSemVer: case latestVersion == "latest": @@ -167,31 +158,28 @@ func MajorUpgradeToV2(logger *log.Logger) error { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - testnet, err := pkg.New("runMajorUpgradeToV2", seed, pkg.GetGrafanaInfoFromEnvVar()) - NoError("failed to create testnet", err) + testnet, err := testnets.New("runMajorUpgradeToV2", seed, testnets.GetGrafanaInfoFromEnvVar()) + testnets.NoError("failed to create testnet", err) defer testnet.Cleanup() preloader, err := knuu.NewPreloader() - NoError("failed to create preloader", err) + testnets.NoError("failed to create preloader", err) defer func() { _ = preloader.EmptyImages() }() - err = preloader.AddImage(pkg.DockerImageName(latestVersion)) - NoError("failed to add image", err) + testnets.NoError("failed to add image", preloader.AddImage(testnets.DockerImageName(latestVersion))) for i := 0; i < numNodes; i++ { - err := testnet.CreateGenesisNode(latestVersion, 10000000, upgradeHeight, pkg.DefaultResources) - NoError("failed to create genesis node", err) + err := testnet.CreateGenesisNode(latestVersion, 10000000, upgradeHeight, testnets.DefaultResources) + testnets.NoError("failed to create genesis node", err) } kr, err := testnet.CreateAccount("alice", 1e12, "") - NoError("failed to create account", err) + testnets.NoError("failed to create account", err) - err = testnet.Setup() - NoError("failed to setup testnet", err) + testnets.NoError("failed to setup testnet", testnet.Setup()) - err = testnet.Start() - NoError("failed to start testnet", err) + testnets.NoError("failed to start testnet", testnet.Start()) errCh := make(chan error) encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) @@ -206,19 +194,18 @@ func MajorUpgradeToV2(logger *log.Logger) error { heightBefore := upgradeHeight - 1 for i := 0; i < numNodes; i++ { client, err := testnet.Node(i).Client() - NoError("failed to get client", err) + testnets.NoError("failed to get client", err) - err = waitForHeight(ctx, client, upgradeHeight, time.Minute) - NoError("failed to wait for height", err) + testnets.NoError("failed to wait for height", waitForHeight(ctx, client, upgradeHeight, time.Minute)) resp, err := client.Header(ctx, &heightBefore) - NoError("failed to get header", err) + testnets.NoError("failed to get header", err) if resp.Header.Version.App != v1.Version { return fmt.Errorf("version mismatch before upgrade: expected %d, got %d", v1.Version, resp.Header.Version.App) } resp, err = client.Header(ctx, &upgradeHeight) - NoError("failed to get header", err) + testnets.NoError("failed to get header", err) if resp.Header.Version.App != v2.Version { return fmt.Errorf("version mismatch before upgrade: expected %d, got %d", v2.Version, resp.Header.Version.App) } diff --git a/test/e2e/main.go b/test/e2e/main.go index aad232f9df..09e52640f0 100644 --- a/test/e2e/main.go +++ b/test/e2e/main.go @@ -16,35 +16,49 @@ const ( var latestVersion = "latest" +type TestFunc func(*log.Logger) error + +type Test struct { + Name string + Func TestFunc +} + func main() { - logger := log.New(os.Stdout, "test", log.LstdFlags) - // FIXME: This test currently panics in InitGenesis - // it's currently not running - if os.Getenv("RUN_MINOR_VERSION_COMPATIBILITY") == "true" { - logger.Println("Running minor version compatibility test") - err := MinorVersionCompatibility(logger) - if err != nil { - logger.Fatalf("Error running minor version compatibility: %v", err) - } + log.SetFlags(0) // Disable additional information like the date or time + log.SetPrefix(" ") + + logger := log.New(os.Stdout, "test-e2e", log.LstdFlags) + + tests := []Test{ + {"MinorVersionCompatibility", MinorVersionCompatibility}, + {"MajorUpgradeToV2", MajorUpgradeToV2}, + {"E2ESimple", E2ESimple}, } - logger.Println("====== Running major upgrade to v2 e2e test ======") - // err := MajorUpgradeToV2(logger) - // if err != nil { - // logger.Fatalf("Error running minor version compatibility: %v", err) - // } + testName := os.Getenv("TEST") - logger.Println("====== Running simple e2e test ======") - err := E2ESimple(logger) - if err != nil { - logger.Fatalf("Error running simple e2e test: %v", err) + if testName != "" { + for _, test := range tests { + fmt.Println(test.Name) + fmt.Println(testName) + if test.Name == testName { + runTest(logger, test) + return + } + } + logger.Fatalf("Unknown test: %s", testName) + } else { + for _, test := range tests { + runTest(logger, test) + } } } -// helper function to wrap errors -func NoError(message string, err error) error { +func runTest(logger *log.Logger, test Test) { + logger.Printf("=== RUN %s", test.Name) + err := test.Func(logger) if err != nil { - return fmt.Errorf("%s: %w", message, err) + logger.Fatalf("--- ERROR %s: %v", test.Name, err) } - return nil + logger.Printf("--- ✅ PASS: %s", test.Name) } diff --git a/test/e2e/pkg/versions_test.go b/test/e2e/pkg/versions_test.go deleted file mode 100644 index 4b09d7cc34..0000000000 --- a/test/e2e/pkg/versions_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package pkg_test - -import ( - "testing" - - "github.com/celestiaorg/celestia-app/v2/test/e2e/pkg" - "github.com/stretchr/testify/require" -) - -func TestVersionParsing(t *testing.T) { - versionStr := "v1.3.0 v1.1.0 v1.2.0-rc0" - versions := pkg.ParseVersions(versionStr) - require.Len(t, versions, 3) - require.Len(t, versions.FilterOutReleaseCandidates(), 2) - require.Equal(t, versions.GetLatest(), pkg.Version{1, 3, 0, false, 0}) -} - -// Test case with multiple major versions and filtering out a single major version -func TestFilterMajorVersions(t *testing.T) { - versionStr := "v2.0.0 v1.1.0 v2.1.0-rc0 v1.2.0 v2.2.0 v1.3.0" - versions := pkg.ParseVersions(versionStr) - require.Len(t, versions, 6) - require.Len(t, versions.FilterMajor(1), 3) -} - -// Test case to check the Order function -func TestOrder(t *testing.T) { - versionStr := "v1.3.0 v1.1.0 v1.2.0-rc0 v1.4.0 v1.2.1 v2.0.0" - versions := pkg.ParseVersions(versionStr) - versions.Order() - require.Equal(t, versions[0], pkg.Version{1, 1, 0, false, 0}) - require.Equal(t, versions[1], pkg.Version{1, 2, 0, true, 0}) - require.Equal(t, versions[2], pkg.Version{1, 2, 1, false, 0}) - require.Equal(t, versions[3], pkg.Version{1, 3, 0, false, 0}) - require.Equal(t, versions[4], pkg.Version{1, 4, 0, false, 0}) - require.Equal(t, versions[5], pkg.Version{2, 0, 0, false, 0}) - for i := len(versions) - 1; i > 0; i-- { - require.True(t, versions[i].IsGreater(versions[i-1])) - } -} - -func TestOrderOfReleaseCandidates(t *testing.T) { - versionsStr := "v1.0.0 v1.0.0-rc0 v1.0.0-rc1" - versions := pkg.ParseVersions(versionsStr) - versions.Order() - require.Equal(t, versions[0], pkg.Version{1, 0, 0, true, 0}) - require.Equal(t, versions[1], pkg.Version{1, 0, 0, true, 1}) - require.Equal(t, versions[2], pkg.Version{1, 0, 0, false, 0}) -} diff --git a/test/e2e/simple.go b/test/e2e/simple.go index 8730450e15..37e6ba385f 100644 --- a/test/e2e/simple.go +++ b/test/e2e/simple.go @@ -3,6 +3,7 @@ package main import ( "context" "errors" + "fmt" "log" "os" "time" @@ -10,22 +11,25 @@ import ( "github.com/celestiaorg/celestia-app/v2/app" "github.com/celestiaorg/celestia-app/v2/app/encoding" "github.com/celestiaorg/celestia-app/v2/pkg/appconsts" - "github.com/celestiaorg/celestia-app/v2/test/e2e/pkg" + "github.com/celestiaorg/celestia-app/v2/test/e2e/testnets" "github.com/celestiaorg/celestia-app/v2/test/txsim" "github.com/celestiaorg/celestia-app/v2/test/util/testnode" ) -// This test runs a simple testnet with 4 validators. It submits both MsgPayForBlobs +// This test runs a simple testnets with 4 validators. It submits both MsgPayForBlobs // and MsgSends over 30 seconds and then asserts that at least 10 transactions were // committed. func E2ESimple(logger *log.Logger) error { + logger.SetFlags(0) + logger.SetPrefix(" ") + if os.Getenv("KNUU_NAMESPACE") != "test" { - logger.Fatal("skipping e2e test") + return fmt.Errorf("skipping e2e throughput test") } if os.Getenv("E2E_LATEST_VERSION") != "" { latestVersion = os.Getenv("E2E_LATEST_VERSION") - _, isSemVer := pkg.ParseVersion(latestVersion) + _, isSemVer := testnets.ParseVersion(latestVersion) switch { case isSemVer: case latestVersion == "latest": @@ -39,25 +43,22 @@ func E2ESimple(logger *log.Logger) error { } logger.Println("Running simple e2e test", "version", latestVersion) - testnet, err := pkg.New("E2ESimple", seed, pkg.GetGrafanaInfoFromEnvVar()) - NoError("failed to create testnet", err) + testnet, err := testnets.New("E2ESimple", seed, testnets.GetGrafanaInfoFromEnvVar()) + testnets.NoError("failed to create testnets", err) defer testnet.Cleanup() - logger.Println("Creating testnet validators") - err = testnet.CreateGenesisNodes(4, latestVersion, 10000000, 0, pkg.DefaultResources) - NoError("failed to create genesis nodes", err) + logger.Println("Creating testnets validators") + testnets.NoError("failed to create genesis nodes", testnet.CreateGenesisNodes(4, latestVersion, 10000000, 0, testnets.DefaultResources)) logger.Println("Creating account") kr, err := testnet.CreateAccount("alice", 1e12, "") - NoError("failed to create account", err) + testnets.NoError("failed to create account", err) - logger.Println("Setting up testnet") - err = testnet.Setup() - NoError("failed to setup testnet", err) + logger.Println("Setting up testnets") + testnets.NoError("failed to setup testnets", testnet.Setup()) - logger.Println("Starting testnet") - err = testnet.Start() - NoError("failed to start testnet", err) + logger.Println("Starting testnets") + testnets.NoError("failed to start testnets", testnet.Start()) logger.Println("Running txsim") sequences := txsim.NewBlobSequence(txsim.NewRange(200, 4000), txsim.NewRange(1, 3)).Clone(5) @@ -70,17 +71,17 @@ func E2ESimple(logger *log.Logger) error { err = txsim.Run(ctx, testnet.GRPCEndpoints()[0], kr, encCfg, opts, sequences...) if !errors.Is(err, context.DeadlineExceeded) { - logger.Fatal("Expected context.DeadlineExceeded, got %v", err) + logger.Fatalf("Expected context.DeadlineExceeded, got %v", err) } logger.Println("Reading blockchain") blockchain, err := testnode.ReadBlockchain(context.Background(), testnet.Node(0).AddressRPC()) - NoError("failed to read blockchain", err) + testnets.NoError("failed to read blockchain", err) totalTxs := 0 for _, block := range blockchain { if appconsts.LatestVersion != block.Version.App { - logger.Fatalf("expected app version %s, got %s", appconsts.LatestVersion, block.Version.App) + logger.Fatalf("expected app version %d, got %d", appconsts.LatestVersion, block.Version.App) } totalTxs += len(block.Data.Txs) } diff --git a/test/e2e/pkg/defaults.go b/test/e2e/testnets/defaults.go similarity index 88% rename from test/e2e/pkg/defaults.go rename to test/e2e/testnets/defaults.go index fb531b7b56..9641d164d2 100644 --- a/test/e2e/pkg/defaults.go +++ b/test/e2e/testnets/defaults.go @@ -1,4 +1,4 @@ -package pkg +package testnets var DefaultResources = Resources{ MemoryRequest: "200Mi", diff --git a/test/e2e/pkg/node.go b/test/e2e/testnets/node.go similarity index 99% rename from test/e2e/pkg/node.go rename to test/e2e/testnets/node.go index 6080d1f4d3..b3d41ce58d 100644 --- a/test/e2e/pkg/node.go +++ b/test/e2e/testnets/node.go @@ -1,4 +1,4 @@ -package pkg +package testnets import ( "fmt" diff --git a/test/e2e/pkg/readme.md b/test/e2e/testnets/readme.md similarity index 100% rename from test/e2e/pkg/readme.md rename to test/e2e/testnets/readme.md diff --git a/test/e2e/pkg/setup.go b/test/e2e/testnets/setup.go similarity index 98% rename from test/e2e/pkg/setup.go rename to test/e2e/testnets/setup.go index 70cc635962..266587e9f9 100644 --- a/test/e2e/pkg/setup.go +++ b/test/e2e/testnets/setup.go @@ -1,4 +1,4 @@ -package pkg +package testnets import ( "fmt" diff --git a/test/e2e/testnets/test_helpers.go b/test/e2e/testnets/test_helpers.go new file mode 100644 index 0000000000..7df9b783cd --- /dev/null +++ b/test/e2e/testnets/test_helpers.go @@ -0,0 +1,11 @@ +package testnets + +import ( + "log" +) + +func NoError(message string, err error) { + if err != nil { + log.Fatalf("%s: %v", message, err) + } +} diff --git a/test/e2e/pkg/testnet.go b/test/e2e/testnets/testnet.go similarity index 99% rename from test/e2e/pkg/testnet.go rename to test/e2e/testnets/testnet.go index ce260cb24b..c818e97e92 100644 --- a/test/e2e/pkg/testnet.go +++ b/test/e2e/testnets/testnet.go @@ -1,4 +1,4 @@ -package pkg +package testnets import ( "context" diff --git a/test/e2e/pkg/txsimNode.go b/test/e2e/testnets/txsimNode.go similarity index 98% rename from test/e2e/pkg/txsimNode.go rename to test/e2e/testnets/txsimNode.go index b70a21cd51..6c8709db32 100644 --- a/test/e2e/pkg/txsimNode.go +++ b/test/e2e/testnets/txsimNode.go @@ -1,4 +1,4 @@ -package pkg +package testnets import ( "fmt" diff --git a/test/e2e/pkg/util.go b/test/e2e/testnets/util.go similarity index 98% rename from test/e2e/pkg/util.go rename to test/e2e/testnets/util.go index 25a5bb61bd..87067fefad 100644 --- a/test/e2e/pkg/util.go +++ b/test/e2e/testnets/util.go @@ -1,4 +1,4 @@ -package pkg +package testnets import ( "io" diff --git a/test/e2e/pkg/versions.go b/test/e2e/testnets/versions.go similarity index 98% rename from test/e2e/pkg/versions.go rename to test/e2e/testnets/versions.go index 3a34a67628..0806493dbb 100644 --- a/test/e2e/pkg/versions.go +++ b/test/e2e/testnets/versions.go @@ -1,4 +1,4 @@ -package pkg +package testnets import ( "fmt" @@ -61,7 +61,6 @@ func ParseVersions(versionStr string) VersionSet { // valid version, the second return value is false. // Must be of the format v1.0.0 or v1.0.0-rc1 (i.e. following SemVer) func ParseVersion(version string) (Version, bool) { - fmt.Println(version, "VERSION in parse v ersion") var major, minor, patch, rc uint64 isRC := false if strings.Contains(version, "rc") { diff --git a/test/e2e/testnets/versions_test.go b/test/e2e/testnets/versions_test.go new file mode 100644 index 0000000000..f15bf69021 --- /dev/null +++ b/test/e2e/testnets/versions_test.go @@ -0,0 +1,49 @@ +package testnets_test + +import ( + "testing" + + "github.com/celestiaorg/celestia-app/v2/test/e2e/testnets" + "github.com/stretchr/testify/require" +) + +func TestVersionParsing(t *testing.T) { + versionStr := "v1.3.0 v1.1.0 v1.2.0-rc0" + versions := testnets.ParseVersions(versionStr) + require.Len(t, versions, 3) + require.Len(t, versions.FilterOutReleaseCandidates(), 2) + require.Equal(t, versions.GetLatest(), testnets.Version{1, 3, 0, false, 0}) +} + +// Test case with multiple major versions and filtering out a single major version +func TestFilterMajorVersions(t *testing.T) { + versionStr := "v2.0.0 v1.1.0 v2.1.0-rc0 v1.2.0 v2.2.0 v1.3.0" + versions := testnets.ParseVersions(versionStr) + require.Len(t, versions, 6) + require.Len(t, versions.FilterMajor(1), 3) +} + +// Test case to check the Order function +func TestOrder(t *testing.T) { + versionStr := "v1.3.0 v1.1.0 v1.2.0-rc0 v1.4.0 v1.2.1 v2.0.0" + versions := testnets.ParseVersions(versionStr) + versions.Order() + require.Equal(t, versions[0], testnets.Version{1, 1, 0, false, 0}) + require.Equal(t, versions[1], testnets.Version{1, 2, 0, true, 0}) + require.Equal(t, versions[2], testnets.Version{1, 2, 1, false, 0}) + require.Equal(t, versions[3], testnets.Version{1, 3, 0, false, 0}) + require.Equal(t, versions[4], testnets.Version{1, 4, 0, false, 0}) + require.Equal(t, versions[5], testnets.Version{2, 0, 0, false, 0}) + for i := len(versions) - 1; i > 0; i-- { + require.True(t, versions[i].IsGreater(versions[i-1])) + } +} + +func TestOrderOfReleaseCandidates(t *testing.T) { + versionsStr := "v1.0.0 v1.0.0-rc0 v1.0.0-rc1" + versions := testnets.ParseVersions(versionsStr) + versions.Order() + require.Equal(t, versions[0], testnets.Version{1, 0, 0, true, 0}) + require.Equal(t, versions[1], testnets.Version{1, 0, 0, true, 1}) + require.Equal(t, versions[2], testnets.Version{1, 0, 0, false, 0}) +} From 56fed046a3dea25daa2f1e0035648f61612dffef Mon Sep 17 00:00:00 2001 From: Nina Barbakadze Date: Mon, 15 Apr 2024 19:28:04 +0200 Subject: [PATCH 03/11] cleaning up --- Makefile | 2 +- test/e2e/benchmark/throughput.go | 7 +++++-- test/e2e/check_upgrades.go | 6 +++--- test/e2e/main.go | 19 +++++++++++-------- test/e2e/{testnets => }/readme.md | 10 ++++++++-- test/e2e/simple.go | 7 +++---- test/e2e/testnets/versions.go | 8 -------- 7 files changed, 31 insertions(+), 28 deletions(-) rename test/e2e/{testnets => }/readme.md (68%) diff --git a/Makefile b/Makefile index a911c4725d..021ab2edab 100644 --- a/Makefile +++ b/Makefile @@ -136,7 +136,7 @@ test-short: ## test-e2e: Run end to end tests via knuu. This command requires a kube/config file to configure kubernetes. test-e2e: @echo "--> Running end to end tests" - @KNUU_NAMESPACE=test KNUU_TIMEOUT=20m E2E_LATEST_VERSION=$(shell git rev-parse --short main) E2E_VERSIONS="$(ALL_VERSIONS)" go test ./test/e2e/... -timeout 20m -v + @KNUU_NAMESPACE=test KNUU_TIMEOUT=20m E2E_LATEST_VERSION=$(shell git rev-parse --short main) E2E_VERSIONS="$(ALL_VERSIONS)" go run test/e2e/*.go -timeout 20m -v .PHONY: test-e2e ## test-race: Run tests in race mode. diff --git a/test/e2e/benchmark/throughput.go b/test/e2e/benchmark/throughput.go index 997f9c76f0..51ba76fd32 100644 --- a/test/e2e/benchmark/throughput.go +++ b/test/e2e/benchmark/throughput.go @@ -23,8 +23,11 @@ func main() { } func E2EThroughput() error { - log.SetFlags(0) // Disable additional information like the date or time - log.SetPrefix(" ") + log.SetPrefix(" ") + + if os.Getenv("KNUU_NAMESPACE") != "test" { + return fmt.Errorf("KNUU_NAMESPACE is not set to 'test") + } if os.Getenv("E2E_LATEST_VERSION") != "" { latestVersion = os.Getenv("E2E_LATEST_VERSION") diff --git a/test/e2e/check_upgrades.go b/test/e2e/check_upgrades.go index bf263cd700..10760c6c01 100644 --- a/test/e2e/check_upgrades.go +++ b/test/e2e/check_upgrades.go @@ -22,7 +22,7 @@ import ( func MinorVersionCompatibility(logger *log.Logger) error { if os.Getenv("KNUU_NAMESPACE") != "test" { - return fmt.Errorf("skipping e2e throughput test") + return fmt.Errorf("%w: KNUU_NAMESPACE is not set to 'test", ErrSkip) } if os.Getenv("E2E_VERSIONS") == "" { @@ -33,7 +33,7 @@ func MinorVersionCompatibility(logger *log.Logger) error { versions := testnets.ParseVersions(versionStr).FilterMajor(MajorVersion).FilterOutReleaseCandidates() if len(versions) == 0 { - logger.Fatal("skipping e2e test: no versions to test") + return fmt.Errorf("%w: no versions to test", ErrSkip) } numNodes := 4 r := rand.New(rand.NewSource(seed)) @@ -135,7 +135,7 @@ func MinorVersionCompatibility(logger *log.Logger) error { func MajorUpgradeToV2(logger *log.Logger) error { if os.Getenv("KNUU_NAMESPACE") != "test" { - logger.Fatal("skipping e2e test") + return fmt.Errorf("%w: KNUU_NAMESPACE is not set to 'test", ErrSkip) } if os.Getenv("E2E_LATEST_VERSION") != "" { diff --git a/test/e2e/main.go b/test/e2e/main.go index 09e52640f0..2002d7655c 100644 --- a/test/e2e/main.go +++ b/test/e2e/main.go @@ -1,7 +1,7 @@ package main import ( - "fmt" + "errors" "log" "os" @@ -14,7 +14,10 @@ const ( seed = 42 ) -var latestVersion = "latest" +var ( + latestVersion = "latest" + ErrSkip = errors.New("skipping e2e test") +) type TestFunc func(*log.Logger) error @@ -24,9 +27,6 @@ type Test struct { } func main() { - log.SetFlags(0) // Disable additional information like the date or time - log.SetPrefix(" ") - logger := log.New(os.Stdout, "test-e2e", log.LstdFlags) tests := []Test{ @@ -39,8 +39,6 @@ func main() { if testName != "" { for _, test := range tests { - fmt.Println(test.Name) - fmt.Println(testName) if test.Name == testName { runTest(logger, test) return @@ -55,10 +53,15 @@ func main() { } func runTest(logger *log.Logger, test Test) { + logger.SetPrefix(" ") logger.Printf("=== RUN %s", test.Name) err := test.Func(logger) if err != nil { + if errors.Is(err, ErrSkip) { + logger.Printf("--- SKIPPING: %s. Reason: %v \n\n", test.Name, err) + return + } logger.Fatalf("--- ERROR %s: %v", test.Name, err) } - logger.Printf("--- ✅ PASS: %s", test.Name) + logger.Printf("--- ✅ PASS: %s \n\n", test.Name) } diff --git a/test/e2e/testnets/readme.md b/test/e2e/readme.md similarity index 68% rename from test/e2e/testnets/readme.md rename to test/e2e/readme.md index 150f25271c..f6283b078a 100644 --- a/test/e2e/testnets/readme.md +++ b/test/e2e/readme.md @@ -6,12 +6,18 @@ End to end tests pull docker images from ghcr.io/celestiaorg/celestia-app. These ## Usage +**Prerequisite: Requires a kubeconfig file.** + +You can run the end-to-end tests using the following command: ```shell -KNUU_NAMESPACE=test E2E_LATEST_VERSION="$(git rev-parse --short main)" E2E_VERSIONS="$(git tag -l)" go test ./test/e2e/... -timeout 30m -v +KNUU_NAMESPACE=test E2E_LATEST_VERSION=$(git rev-parse --short main) E2E_VERSIONS="$(git tag -l)" go run test/e2e/*.go -timeout 30m -v ``` -You can optionally set a global timeout using `KNUU_TIMEOUT` (default is 60m). +**Optional parameters**: + +- `KNUUU_TIMEOUT` can be used to override the default timeout of 60 minutes for the tests. +- `TEST` can be used to run a specific E2E test. For example, `TEST=MinorVersionCompatibility` would run the MinorVersionCompatibility test. ## Observation diff --git a/test/e2e/simple.go b/test/e2e/simple.go index 37e6ba385f..95e89351f2 100644 --- a/test/e2e/simple.go +++ b/test/e2e/simple.go @@ -22,9 +22,8 @@ import ( func E2ESimple(logger *log.Logger) error { logger.SetFlags(0) logger.SetPrefix(" ") - if os.Getenv("KNUU_NAMESPACE") != "test" { - return fmt.Errorf("skipping e2e throughput test") + return fmt.Errorf("%w: KNUU_NAMESPACE is not set to 'test", ErrSkip) } if os.Getenv("E2E_LATEST_VERSION") != "" { @@ -81,12 +80,12 @@ func E2ESimple(logger *log.Logger) error { totalTxs := 0 for _, block := range blockchain { if appconsts.LatestVersion != block.Version.App { - logger.Fatalf("expected app version %d, got %d", appconsts.LatestVersion, block.Version.App) + return fmt.Errorf("expected app version %d, got %d", appconsts.LatestVersion, block.Version.App) } totalTxs += len(block.Data.Txs) } if totalTxs < 10 { - logger.Fatalf("expected at least 10 transactions, got %d", totalTxs) + return fmt.Errorf("expected at least 10 transactions, got %d", totalTxs) } return nil } diff --git a/test/e2e/testnets/versions.go b/test/e2e/testnets/versions.go index 0806493dbb..3f2454a3c4 100644 --- a/test/e2e/testnets/versions.go +++ b/test/e2e/testnets/versions.go @@ -45,7 +45,6 @@ type VersionSet []Version func ParseVersions(versionStr string) VersionSet { versions := strings.Split(versionStr, " ") output := make(VersionSet, 0, len(versions)) - fmt.Println(versions, "VERSIONSSS") for _, v := range versions { version, isValid := ParseVersion(v) if !isValid { @@ -53,7 +52,6 @@ func ParseVersions(versionStr string) VersionSet { } output = append(output, version) } - fmt.Println(output, "output") return output } @@ -64,12 +62,9 @@ func ParseVersion(version string) (Version, bool) { var major, minor, patch, rc uint64 isRC := false if strings.Contains(version, "rc") { - fmt.Println("HERE") _, err := fmt.Sscanf(version, "v%d.%d.%d-rc%d", &major, &minor, &patch, &rc) isRC = true if err != nil { - fmt.Println(err, "ERROR", version) - fmt.Println("HERE 2") return Version{}, false } } else { @@ -78,7 +73,6 @@ func ParseVersion(version string) (Version, bool) { return Version{}, false } } - fmt.Println(Version{major, minor, patch, isRC, rc}, true, "PARSE VERSION") return Version{major, minor, patch, isRC, rc}, true } @@ -89,7 +83,6 @@ func (v VersionSet) FilterMajor(majorVersion uint64) VersionSet { output = append(output, version) } } - fmt.Println(output, "output") return output } @@ -97,7 +90,6 @@ func (v VersionSet) FilterOutReleaseCandidates() VersionSet { output := make(VersionSet, 0, len(v)) for _, version := range v { if version.IsRC { - fmt.Println("skipping version", version.String()) continue } output = append(output, version) From a390546d52b46606263a09d900713ecdc8b539ac Mon Sep 17 00:00:00 2001 From: Nina Barbakadze Date: Mon, 15 Apr 2024 19:43:34 +0200 Subject: [PATCH 04/11] chore: disable failing tests --- test/e2e/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e/main.go b/test/e2e/main.go index 2002d7655c..fc563b006b 100644 --- a/test/e2e/main.go +++ b/test/e2e/main.go @@ -8,7 +8,6 @@ import ( v1 "github.com/celestiaorg/celestia-app/v2/pkg/appconsts/v1" ) -// This will only run tests within the v1 major release cycle const ( MajorVersion = v1.Version seed = 42 @@ -30,8 +29,9 @@ func main() { logger := log.New(os.Stdout, "test-e2e", log.LstdFlags) tests := []Test{ - {"MinorVersionCompatibility", MinorVersionCompatibility}, - {"MajorUpgradeToV2", MajorUpgradeToV2}, + // FIXME both tests are currently failing + // {"MinorVersionCompatibility", MinorVersionCompatibility}, + // {"MajorUpgradeToV2", MajorUpgradeToV2}, {"E2ESimple", E2ESimple}, } From 9a0bea597029ee7e23ace09795df8f49e9b9f5bb Mon Sep 17 00:00:00 2001 From: Nina Barbakadze Date: Tue, 16 Apr 2024 10:13:10 +0200 Subject: [PATCH 05/11] style: more nits --- test/e2e/check_upgrades.go | 8 ++++---- test/e2e/simple.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/e2e/check_upgrades.go b/test/e2e/check_upgrades.go index 10760c6c01..0fbe4e389d 100644 --- a/test/e2e/check_upgrades.go +++ b/test/e2e/check_upgrades.go @@ -22,11 +22,11 @@ import ( func MinorVersionCompatibility(logger *log.Logger) error { if os.Getenv("KNUU_NAMESPACE") != "test" { - return fmt.Errorf("%w: KNUU_NAMESPACE is not set to 'test", ErrSkip) + return fmt.Errorf("%w: KNUU_NAMESPACE is not set to 'test'", ErrSkip) } if os.Getenv("E2E_VERSIONS") == "" { - logger.Fatal("skipping e2e test: E2E_VERSIONS not set") + return fmt.Errorf("%w: E2E_VERSIONS not set", ErrSkip) } versionStr := os.Getenv("E2E_VERSIONS") @@ -135,7 +135,7 @@ func MinorVersionCompatibility(logger *log.Logger) error { func MajorUpgradeToV2(logger *log.Logger) error { if os.Getenv("KNUU_NAMESPACE") != "test" { - return fmt.Errorf("%w: KNUU_NAMESPACE is not set to 'test", ErrSkip) + return fmt.Errorf("%w: KNUU_NAMESPACE is not set to 'test'", ErrSkip) } if os.Getenv("E2E_LATEST_VERSION") != "" { @@ -149,7 +149,7 @@ func MajorUpgradeToV2(logger *log.Logger) error { // assume this is a git commit hash (we need to trim the last digit to match the docker image tag) latestVersion = latestVersion[:7] default: - logger.Fatalf("unrecognised version: %s", latestVersion) + return fmt.Errorf("unrecognised version: %s: %w", latestVersion, ErrSkip) } } diff --git a/test/e2e/simple.go b/test/e2e/simple.go index 95e89351f2..0a8f22e297 100644 --- a/test/e2e/simple.go +++ b/test/e2e/simple.go @@ -23,7 +23,7 @@ func E2ESimple(logger *log.Logger) error { logger.SetFlags(0) logger.SetPrefix(" ") if os.Getenv("KNUU_NAMESPACE") != "test" { - return fmt.Errorf("%w: KNUU_NAMESPACE is not set to 'test", ErrSkip) + return fmt.Errorf("%w: KNUU_NAMESPACE is not set to 'test'", ErrSkip) } if os.Getenv("E2E_LATEST_VERSION") != "" { @@ -37,7 +37,7 @@ func E2ESimple(logger *log.Logger) error { // assume this is a git commit hash (we need to trim the last digit to match the docker image tag) latestVersion = latestVersion[:7] default: - logger.Fatalf("unrecognised version: %s", latestVersion) + return fmt.Errorf("unrecognised version: %s: %w", latestVersion, ErrSkip) } } logger.Println("Running simple e2e test", "version", latestVersion) @@ -70,7 +70,7 @@ func E2ESimple(logger *log.Logger) error { err = txsim.Run(ctx, testnet.GRPCEndpoints()[0], kr, encCfg, opts, sequences...) if !errors.Is(err, context.DeadlineExceeded) { - logger.Fatalf("Expected context.DeadlineExceeded, got %v", err) + return fmt.Errorf("expected context.DeadlineExceeded, got %w", err) } logger.Println("Reading blockchain") @@ -80,7 +80,7 @@ func E2ESimple(logger *log.Logger) error { totalTxs := 0 for _, block := range blockchain { if appconsts.LatestVersion != block.Version.App { - return fmt.Errorf("expected app version %d, got %d", appconsts.LatestVersion, block.Version.App) + return fmt.Errorf("expected app version %d, got %d in block %d", appconsts.LatestVersion, block.Version.App, block.Height) } totalTxs += len(block.Data.Txs) } From 8b1faa8152ae38dbe8d582205dc87d9825d5df35 Mon Sep 17 00:00:00 2001 From: Nina Barbakadze Date: Tue, 16 Apr 2024 17:03:08 +0200 Subject: [PATCH 06/11] refactor: address review changes --- Makefile | 2 +- test/e2e/benchmark/throughput.go | 24 ++--------- test/e2e/check_upgrades.go | 69 ++++++++++++++++---------------- test/e2e/main.go | 20 +++++---- test/e2e/simple.go | 25 +++--------- test/e2e/testnets/versions.go | 27 +++++++++++++ 6 files changed, 83 insertions(+), 84 deletions(-) diff --git a/Makefile b/Makefile index 021ab2edab..39eada23f6 100644 --- a/Makefile +++ b/Makefile @@ -136,7 +136,7 @@ test-short: ## test-e2e: Run end to end tests via knuu. This command requires a kube/config file to configure kubernetes. test-e2e: @echo "--> Running end to end tests" - @KNUU_NAMESPACE=test KNUU_TIMEOUT=20m E2E_LATEST_VERSION=$(shell git rev-parse --short main) E2E_VERSIONS="$(ALL_VERSIONS)" go run test/e2e/*.go -timeout 20m -v + @KNUU_NAMESPACE=test go run test/e2e/*.go -timeout 20m -v .PHONY: test-e2e ## test-race: Run tests in race mode. diff --git a/test/e2e/benchmark/throughput.go b/test/e2e/benchmark/throughput.go index 51ba76fd32..fec9849c2f 100644 --- a/test/e2e/benchmark/throughput.go +++ b/test/e2e/benchmark/throughput.go @@ -12,8 +12,6 @@ import ( "github.com/celestiaorg/celestia-app/v2/test/util/testnode" ) -var latestVersion = "latest" - const seed = 42 func main() { @@ -23,26 +21,10 @@ func main() { } func E2EThroughput() error { - log.SetPrefix(" ") - - if os.Getenv("KNUU_NAMESPACE") != "test" { - return fmt.Errorf("KNUU_NAMESPACE is not set to 'test") - } + os.Setenv("KNUU_NAMESPACE", "test") - if os.Getenv("E2E_LATEST_VERSION") != "" { - latestVersion = os.Getenv("E2E_LATEST_VERSION") - _, isSemVer := testnets.ParseVersion(latestVersion) - switch { - case isSemVer: - case latestVersion == "latest": - case len(latestVersion) == 7: - case len(latestVersion) >= 8: - // assume this is a git commit hash (we need to trim the last digit to match the docker image tag) - latestVersion = latestVersion[:7] - default: - return fmt.Errorf("unrecognised version %s", latestVersion) - } - } + latestVersion, err := testnets.GetLatestVersion() + testnets.NoError("failed to get latest version", err) log.Println("=== RUN E2EThroughput", "version:", latestVersion) diff --git a/test/e2e/check_upgrades.go b/test/e2e/check_upgrades.go index 0fbe4e389d..646f64d9e3 100644 --- a/test/e2e/check_upgrades.go +++ b/test/e2e/check_upgrades.go @@ -7,6 +7,7 @@ import ( "log" "math/rand" "os" + "os/exec" "strings" "time" @@ -21,15 +22,10 @@ import ( ) func MinorVersionCompatibility(logger *log.Logger) error { - if os.Getenv("KNUU_NAMESPACE") != "test" { - return fmt.Errorf("%w: KNUU_NAMESPACE is not set to 'test'", ErrSkip) - } - - if os.Getenv("E2E_VERSIONS") == "" { - return fmt.Errorf("%w: E2E_VERSIONS not set", ErrSkip) - } + os.Setenv("KNUU_NAMESPACE", "test") - versionStr := os.Getenv("E2E_VERSIONS") + versionStr, err := getAllVersions() + testnets.NoError("failed to get versions", err) versions := testnets.ParseVersions(versionStr).FilterMajor(MajorVersion).FilterOutReleaseCandidates() if len(versions) == 0 { @@ -39,7 +35,7 @@ func MinorVersionCompatibility(logger *log.Logger) error { r := rand.New(rand.NewSource(seed)) logger.Println("Running minor version compatibility test", "versions", versions) - testnet, err := testnets.New("runMinorVersionCompatibility", seed, testnets.GetGrafanaInfoFromEnvVar()) + testnet, err := testnets.New("runMinorVersionCompatibility", seed, nil) testnets.NoError("failed to create testnet", err) defer testnet.Cleanup() @@ -58,7 +54,7 @@ func MinorVersionCompatibility(logger *log.Logger) error { for i := 0; i < numNodes; i++ { // each node begins with a random version within the same major version set v := versions.Random(r).String() - fmt.Println("Starting node", "node", i, "version", v) + logger.Println("Starting node", "node", i, "version", v) testnets.NoError("failed to create genesis node", testnet.CreateGenesisNode(v, 10000000, 0, testnets.DefaultResources)) } @@ -66,9 +62,9 @@ func MinorVersionCompatibility(logger *log.Logger) error { testnets.NoError("failed to create account", err) // start the testnet - fmt.Println("Setting up testnet") + logger.Println("Setting up testnet") testnets.NoError("Failed to setup testnet", testnet.Setup()) - fmt.Println("Starting testnet") + logger.Println("Starting testnet") testnets.NoError("Failed to start testnet", testnet.Start()) // TODO: with upgrade tests we should simulate a far broader range of transactions @@ -97,8 +93,8 @@ func MinorVersionCompatibility(logger *log.Logger) error { testnets.NoError("failed to get height", err) newVersion := versions.Random(r).String() - logger.Println("Upgrading node", "node", i%numNodes, "version", newVersion) - testnets.NoError("failed to upgrade node", testnet.Node(i%numNodes).Upgrade(newVersion)) + logger.Println("Upgrading node", "node", i%numNodes+1, "version", newVersion) + testnets.NoError("failed to upgrade node", testnet.Node(i%numNodes+1).Upgrade(newVersion)) // wait for the node to reach two more heights testnets.NoError("failed to wait for height", waitForHeight(ctx, client, heightBefore+2, 30*time.Second)) } @@ -134,31 +130,20 @@ func MinorVersionCompatibility(logger *log.Logger) error { } func MajorUpgradeToV2(logger *log.Logger) error { - if os.Getenv("KNUU_NAMESPACE") != "test" { - return fmt.Errorf("%w: KNUU_NAMESPACE is not set to 'test'", ErrSkip) - } + os.Setenv("KNUU_NAMESPACE", "test") - if os.Getenv("E2E_LATEST_VERSION") != "" { - latestVersion = os.Getenv("E2E_LATEST_VERSION") - _, isSemVer := testnets.ParseVersion(latestVersion) - switch { - case isSemVer: - case latestVersion == "latest": - case len(latestVersion) == 7: - case len(latestVersion) == 8: - // assume this is a git commit hash (we need to trim the last digit to match the docker image tag) - latestVersion = latestVersion[:7] - default: - return fmt.Errorf("unrecognised version: %s: %w", latestVersion, ErrSkip) - } - } + latestVersion, err := testnets.GetLatestVersion() + testnets.NoError("failed to get latest version", err) + + logger.Println("Running major upgrade to v2 test", "version", latestVersion) numNodes := 4 upgradeHeight := int64(12) ctx, cancel := context.WithCancel(context.Background()) defer cancel() - testnet, err := testnets.New("runMajorUpgradeToV2", seed, testnets.GetGrafanaInfoFromEnvVar()) + logger.Println("Creating testnet") + testnet, err := testnets.New("runMajorUpgradeToV2", seed, nil) testnets.NoError("failed to create testnet", err) defer testnet.Cleanup() @@ -169,6 +154,7 @@ func MajorUpgradeToV2(logger *log.Logger) error { defer func() { _ = preloader.EmptyImages() }() testnets.NoError("failed to add image", preloader.AddImage(testnets.DockerImageName(latestVersion))) + logger.Println("Creating genesis nodes") for i := 0; i < numNodes; i++ { err := testnet.CreateGenesisNode(latestVersion, 10000000, upgradeHeight, testnets.DefaultResources) testnets.NoError("failed to create genesis node", err) @@ -176,10 +162,12 @@ func MajorUpgradeToV2(logger *log.Logger) error { kr, err := testnet.CreateAccount("alice", 1e12, "") testnets.NoError("failed to create account", err) + // start the testnet - testnets.NoError("failed to setup testnet", testnet.Setup()) - - testnets.NoError("failed to start testnet", testnet.Start()) + logger.Println("Setting up testnet") + testnets.NoError("Failed to setup testnet", testnet.Setup()) + logger.Println("Starting testnet") + testnets.NoError("Failed to start testnet", testnet.Start()) errCh := make(chan error) encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) @@ -200,6 +188,7 @@ func MajorUpgradeToV2(logger *log.Logger) error { resp, err := client.Header(ctx, &heightBefore) testnets.NoError("failed to get header", err) + logger.Println("Node", i, "is running on version", resp.Header.Version.App) if resp.Header.Version.App != v1.Version { return fmt.Errorf("version mismatch before upgrade: expected %d, got %d", v1.Version, resp.Header.Version.App) } @@ -258,3 +247,13 @@ func waitForHeight(ctx context.Context, client *http.HTTP, height int64, period } } } + +func getAllVersions() (string, error) { + cmd := exec.Command("git", "tag", "-l") + output, err := cmd.Output() + if err != nil { + return "", fmt.Errorf("failed to get git tags: %v", err) + } + allVersions := strings.Split(strings.TrimSpace(string(output)), "\n") + return strings.Join(allVersions, " "), nil +} diff --git a/test/e2e/main.go b/test/e2e/main.go index fc563b006b..b1be22a615 100644 --- a/test/e2e/main.go +++ b/test/e2e/main.go @@ -4,6 +4,7 @@ import ( "errors" "log" "os" + "strings" v1 "github.com/celestiaorg/celestia-app/v2/pkg/appconsts/v1" ) @@ -13,10 +14,7 @@ const ( seed = 42 ) -var ( - latestVersion = "latest" - ErrSkip = errors.New("skipping e2e test") -) +var ErrSkip = errors.New("skipping e2e test") type TestFunc func(*log.Logger) error @@ -31,8 +29,8 @@ func main() { tests := []Test{ // FIXME both tests are currently failing // {"MinorVersionCompatibility", MinorVersionCompatibility}, - // {"MajorUpgradeToV2", MajorUpgradeToV2}, - {"E2ESimple", E2ESimple}, + {"MajorUpgradeToV2", MajorUpgradeToV2}, + // {"E2ESimple", E2ESimple}, } testName := os.Getenv("TEST") @@ -44,7 +42,7 @@ func main() { return } } - logger.Fatalf("Unknown test: %s", testName) + logger.Fatalf("Unknown test: %s. Valid tests are: %v", testName, getTestNames(tests)) } else { for _, test := range tests { runTest(logger, test) @@ -65,3 +63,11 @@ func runTest(logger *log.Logger, test Test) { } logger.Printf("--- ✅ PASS: %s \n\n", test.Name) } + +func getTestNames(tests []Test) string { + testNames := make([]string, len(tests)) + for _, test := range tests { + testNames = append(testNames, test.Name) + } + return strings.Join(testNames, ", ") +} diff --git a/test/e2e/simple.go b/test/e2e/simple.go index 0a8f22e297..c2d2911ccf 100644 --- a/test/e2e/simple.go +++ b/test/e2e/simple.go @@ -20,29 +20,14 @@ import ( // and MsgSends over 30 seconds and then asserts that at least 10 transactions were // committed. func E2ESimple(logger *log.Logger) error { - logger.SetFlags(0) - logger.SetPrefix(" ") - if os.Getenv("KNUU_NAMESPACE") != "test" { - return fmt.Errorf("%w: KNUU_NAMESPACE is not set to 'test'", ErrSkip) - } + os.Setenv("KNUU_NAMESPACE", "test") + + latestVersion, err := testnets.GetLatestVersion() + testnets.NoError("failed to get latest version", err) - if os.Getenv("E2E_LATEST_VERSION") != "" { - latestVersion = os.Getenv("E2E_LATEST_VERSION") - _, isSemVer := testnets.ParseVersion(latestVersion) - switch { - case isSemVer: - case latestVersion == "latest": - case len(latestVersion) == 7: - case len(latestVersion) >= 8: - // assume this is a git commit hash (we need to trim the last digit to match the docker image tag) - latestVersion = latestVersion[:7] - default: - return fmt.Errorf("unrecognised version: %s: %w", latestVersion, ErrSkip) - } - } logger.Println("Running simple e2e test", "version", latestVersion) - testnet, err := testnets.New("E2ESimple", seed, testnets.GetGrafanaInfoFromEnvVar()) + testnet, err := testnets.New("E2ESimple", seed, nil) testnets.NoError("failed to create testnets", err) defer testnet.Cleanup() diff --git a/test/e2e/testnets/versions.go b/test/e2e/testnets/versions.go index 3f2454a3c4..2d029f3134 100644 --- a/test/e2e/testnets/versions.go +++ b/test/e2e/testnets/versions.go @@ -3,6 +3,7 @@ package testnets import ( "fmt" "math/rand" + "os/exec" "sort" "strings" ) @@ -76,6 +77,32 @@ func ParseVersion(version string) (Version, bool) { return Version{major, minor, patch, isRC, rc}, true } +// GetLatestVersion retrieves the latest git commit hash +// or semantic version of the main branch. +func GetLatestVersion() (string, error) { + cmd := exec.Command("git", "rev-parse", "--short", "main") + output, err := cmd.Output() + if err != nil { + return "", fmt.Errorf("failed to get git commit hash: %v", err) + } + latestVersion := string(output) + + _, isSemVer := ParseVersion(latestVersion) + switch { + case isSemVer: + return latestVersion, nil + case latestVersion == "latest": + return latestVersion, nil + case len(latestVersion) == 7: + return latestVersion, nil + case len(latestVersion) >= 8: + // assume this is a git commit hash (we need to trim the last digit to match the docker image tag) + return latestVersion[:7], nil + default: + return "", fmt.Errorf("unrecognised version %s", latestVersion) + } +} + func (v VersionSet) FilterMajor(majorVersion uint64) VersionSet { output := make(VersionSet, 0, len(v)) for _, version := range v { From c6ab4ac31811561177a19db8fa89d45bfd9d7722 Mon Sep 17 00:00:00 2001 From: Nina Barbakadze Date: Tue, 16 Apr 2024 17:15:30 +0200 Subject: [PATCH 07/11] refacotor: comment out the broken function --- test/e2e/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/main.go b/test/e2e/main.go index b1be22a615..b86cc6921d 100644 --- a/test/e2e/main.go +++ b/test/e2e/main.go @@ -29,8 +29,8 @@ func main() { tests := []Test{ // FIXME both tests are currently failing // {"MinorVersionCompatibility", MinorVersionCompatibility}, - {"MajorUpgradeToV2", MajorUpgradeToV2}, - // {"E2ESimple", E2ESimple}, + // {"MajorUpgradeToV2", MajorUpgradeToV2}, + {"E2ESimple", E2ESimple}, } testName := os.Getenv("TEST") From 19c363ce42c1c4c333f874d325138364459f285d Mon Sep 17 00:00:00 2001 From: Nina Barbakadze Date: Tue, 16 Apr 2024 17:32:58 +0200 Subject: [PATCH 08/11] refactor: remove errskip and update docs --- Makefile | 1 - test/e2e/check_upgrades.go | 2 +- test/e2e/main.go | 7 ------- test/e2e/readme.md | 2 +- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 39eada23f6..199ddaf093 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ VERSION := $(shell echo $(shell git describe --tags 2>/dev/null || git log -1 --format='%h') | sed 's/^v//') COMMIT := $(shell git rev-parse --short HEAD) DOCKER := $(shell which docker) -ALL_VERSIONS := $(shell git tag -l) DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf IMAGE := ghcr.io/tendermint/docker-build-proto:latest DOCKER_PROTO_BUILDER := docker run -v $(shell pwd):/workspace --workdir /workspace $(IMAGE) diff --git a/test/e2e/check_upgrades.go b/test/e2e/check_upgrades.go index 646f64d9e3..f8f751c4c4 100644 --- a/test/e2e/check_upgrades.go +++ b/test/e2e/check_upgrades.go @@ -29,7 +29,7 @@ func MinorVersionCompatibility(logger *log.Logger) error { versions := testnets.ParseVersions(versionStr).FilterMajor(MajorVersion).FilterOutReleaseCandidates() if len(versions) == 0 { - return fmt.Errorf("%w: no versions to test", ErrSkip) + logger.Fatal("no versions to test") } numNodes := 4 r := rand.New(rand.NewSource(seed)) diff --git a/test/e2e/main.go b/test/e2e/main.go index b86cc6921d..c189ec1b40 100644 --- a/test/e2e/main.go +++ b/test/e2e/main.go @@ -1,7 +1,6 @@ package main import ( - "errors" "log" "os" "strings" @@ -14,8 +13,6 @@ const ( seed = 42 ) -var ErrSkip = errors.New("skipping e2e test") - type TestFunc func(*log.Logger) error type Test struct { @@ -55,10 +52,6 @@ func runTest(logger *log.Logger, test Test) { logger.Printf("=== RUN %s", test.Name) err := test.Func(logger) if err != nil { - if errors.Is(err, ErrSkip) { - logger.Printf("--- SKIPPING: %s. Reason: %v \n\n", test.Name, err) - return - } logger.Fatalf("--- ERROR %s: %v", test.Name, err) } logger.Printf("--- ✅ PASS: %s \n\n", test.Name) diff --git a/test/e2e/readme.md b/test/e2e/readme.md index f6283b078a..4291ba0de5 100644 --- a/test/e2e/readme.md +++ b/test/e2e/readme.md @@ -11,7 +11,7 @@ End to end tests pull docker images from ghcr.io/celestiaorg/celestia-app. These You can run the end-to-end tests using the following command: ```shell -KNUU_NAMESPACE=test E2E_LATEST_VERSION=$(git rev-parse --short main) E2E_VERSIONS="$(git tag -l)" go run test/e2e/*.go -timeout 30m -v +go run test/e2e/*.go -timeout 30m -v ``` **Optional parameters**: From 1ea2bf3a234fcdaa5ca031767e327a5afe5a809b Mon Sep 17 00:00:00 2001 From: Nina Barbakadze Date: Tue, 16 Apr 2024 20:51:56 +0200 Subject: [PATCH 09/11] refactor: pass args instead of env variables --- Makefile | 2 +- test/e2e/main.go | 22 ++++++++++++++-------- test/e2e/readme.md | 17 +++++++++++++++-- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 199ddaf093..e0d680d9e3 100644 --- a/Makefile +++ b/Makefile @@ -135,7 +135,7 @@ test-short: ## test-e2e: Run end to end tests via knuu. This command requires a kube/config file to configure kubernetes. test-e2e: @echo "--> Running end to end tests" - @KNUU_NAMESPACE=test go run test/e2e/*.go -timeout 20m -v + @KNUU_NAMESPACE=test go run test/e2e/*.go -timeout 20m -v $(filter-out $@,$(MAKECMDGOALS)) .PHONY: test-e2e ## test-race: Run tests in race mode. diff --git a/test/e2e/main.go b/test/e2e/main.go index c189ec1b40..d99c0a68c0 100644 --- a/test/e2e/main.go +++ b/test/e2e/main.go @@ -30,17 +30,23 @@ func main() { {"E2ESimple", E2ESimple}, } - testName := os.Getenv("TEST") - - if testName != "" { + // check if a specific test is passed and run it + specificTestFound := false + for _, arg := range os.Args[1:] { for _, test := range tests { - if test.Name == testName { + if test.Name == arg { runTest(logger, test) - return + specificTestFound = true + break } } - logger.Fatalf("Unknown test: %s. Valid tests are: %v", testName, getTestNames(tests)) - } else { + } + + if !specificTestFound { + logger.Println("No particular test specified. Running all tests.") + logger.Println("go run test/e2e/*.go to run a specific test") + logger.Printf("Valid tests are: %s\n\n", getTestNames(tests)) + // if no specific test is passed, run all tests for _, test := range tests { runTest(logger, test) } @@ -58,7 +64,7 @@ func runTest(logger *log.Logger, test Test) { } func getTestNames(tests []Test) string { - testNames := make([]string, len(tests)) + testNames := make([]string, 0, len(tests)) for _, test := range tests { testNames = append(testNames, test.Name) } diff --git a/test/e2e/readme.md b/test/e2e/readme.md index 4291ba0de5..2f40dce941 100644 --- a/test/e2e/readme.md +++ b/test/e2e/readme.md @@ -8,16 +8,29 @@ End to end tests pull docker images from ghcr.io/celestiaorg/celestia-app. These **Prerequisite: Requires a kubeconfig file.** -You can run the end-to-end tests using the following command: +You can run the End-to-End tests using either of the following commands: ```shell go run test/e2e/*.go -timeout 30m -v ``` +```shell +make test-e2e +``` + +To run a specific test, you can pass the name of the test as a command-line argument. For example, to run the "E2ESimple" test, you would use either of the specified commands: + +```shell +go run test/e2e/*.go E2ESimple +``` + +```shell +make test-e2e E2ESimple +``` + **Optional parameters**: - `KNUUU_TIMEOUT` can be used to override the default timeout of 60 minutes for the tests. -- `TEST` can be used to run a specific E2E test. For example, `TEST=MinorVersionCompatibility` would run the MinorVersionCompatibility test. ## Observation From a90a755fbfeafe4cbfc7265d72e59e5b1c742a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nina=20/=20=E1=83=9C=E1=83=98=E1=83=9C=E1=83=90?= Date: Wed, 17 Apr 2024 16:33:57 +0200 Subject: [PATCH 10/11] Update Makefile Co-authored-by: Callum Waters --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e0d680d9e3..4457400d3d 100644 --- a/Makefile +++ b/Makefile @@ -135,7 +135,7 @@ test-short: ## test-e2e: Run end to end tests via knuu. This command requires a kube/config file to configure kubernetes. test-e2e: @echo "--> Running end to end tests" - @KNUU_NAMESPACE=test go run test/e2e/*.go -timeout 20m -v $(filter-out $@,$(MAKECMDGOALS)) + go run ./test/e2e -v $(filter-out $@,$(MAKECMDGOALS)) .PHONY: test-e2e ## test-race: Run tests in race mode. From 9ed05125a383be870adee5f31952ea58564a06aa Mon Sep 17 00:00:00 2001 From: Nina Barbakadze Date: Wed, 17 Apr 2024 16:42:43 +0200 Subject: [PATCH 11/11] refactor: change the command --- Makefile | 2 +- test/e2e/readme.md | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4457400d3d..65ab14103d 100644 --- a/Makefile +++ b/Makefile @@ -135,7 +135,7 @@ test-short: ## test-e2e: Run end to end tests via knuu. This command requires a kube/config file to configure kubernetes. test-e2e: @echo "--> Running end to end tests" - go run ./test/e2e -v $(filter-out $@,$(MAKECMDGOALS)) + go run ./test/e2e $(filter-out $@,$(MAKECMDGOALS)) .PHONY: test-e2e ## test-race: Run tests in race mode. diff --git a/test/e2e/readme.md b/test/e2e/readme.md index 2f40dce941..1f0b370d22 100644 --- a/test/e2e/readme.md +++ b/test/e2e/readme.md @@ -11,8 +11,7 @@ End to end tests pull docker images from ghcr.io/celestiaorg/celestia-app. These You can run the End-to-End tests using either of the following commands: ```shell -go run test/e2e/*.go -timeout 30m -v -``` +go run ./test/e2e``` ```shell make test-e2e @@ -21,7 +20,7 @@ make test-e2e To run a specific test, you can pass the name of the test as a command-line argument. For example, to run the "E2ESimple" test, you would use either of the specified commands: ```shell -go run test/e2e/*.go E2ESimple +go run ./test/e2e E2ESimple ``` ```shell