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

test: minor version upgrade e2e testing #2797

Merged
merged 15 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION := $(shell echo $(shell git describe --tags 2>/dev/null || git log -1 --format='%h') | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
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)
Expand Down Expand Up @@ -117,9 +118,8 @@ test-short:

## test-e2e: Run end to end tests via knuu. This command requires a kube/config file to configure kubernetes.
test-e2e:
@export E2E_VERSIONS=$(git tag -l)
@echo "--> Running end to end tests"
@KNUU_NAMESPACE=test E2E=true go test ./test/e2e/... -timeout 10m -v
@KNUU_NAMESPACE=test E2E_VERSIONS="$(ALL_VERSIONS)" E2E=true go test ./test/e2e/... -timeout 10m -v
.PHONY: test-e2e

## test-race: Run tests in race mode.
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ var latestVersion = "latest"
// and MsgSends over 30 seconds and then asserts that at least 10 transactions were
// committed.
func TestE2ESimple(t *testing.T) {
t.Skip()
cmwaters marked this conversation as resolved.
Show resolved Hide resolved
if os.Getenv("E2E") != "true" {
t.Skip("skipping e2e test")
}

if os.Getenv("E2E_VERSIONS") != "" {
versionsStr := os.Getenv("E2E_VERSIONS")
versions := ParseVersions(versionsStr)
latestVersion = versions.GetLatest().String()
if len(versions) > 0 {
latestVersion = versions.GetLatest().String()
}
}
t.Log("Running simple e2e test", "version", latestVersion)

Expand Down
3 changes: 3 additions & 0 deletions test/e2e/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ func TestMinorVersionCompatibility(t *testing.T) {

versionStr := os.Getenv("E2E_VERSIONS")
versions := ParseVersions(versionStr).FilterMajor(MajorVersion).FilterOutReleaseCandidates()
if len(versions) == 0 {
t.Skip("skipping e2e test: no versions to test")
}
numNodes := 4
evan-forbes marked this conversation as resolved.
Show resolved Hide resolved
r := rand.New(rand.NewSource(seed))
t.Log("Running minor version compatibility test", "versions", versions)
rootulp marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (v Version) IsGreater(v2 Version) bool {
type VersionSet []Version

func ParseVersions(versionStr string) VersionSet {
versions := strings.Split(versionStr, "\n")
versions := strings.Split(versionStr, " ")
output := make(VersionSet, 0, len(versions))
for _, v := range versions {
var major, minor, patch, rc uint64
Expand Down Expand Up @@ -101,6 +101,9 @@ func (v VersionSet) Order() {
}

func (v VersionSet) Random(r *rand.Rand) Version {
if len(v) == 0 {
panic("there are no versions to pick from")
}
return v[r.Intn(len(v))]
}

Expand Down
8 changes: 4 additions & 4 deletions test/e2e/versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestVersionParsing(t *testing.T) {
versionStr := "v1.3.0\nv1.1.0\nv1.2.0-rc0"
versionStr := "v1.3.0 v1.1.0 v1.2.0-rc0"
versions := e2e.ParseVersions(versionStr)
require.Len(t, versions, 3)
require.Len(t, versions.FilterOutReleaseCandidates(), 2)
Expand All @@ -17,15 +17,15 @@ func TestVersionParsing(t *testing.T) {

// Test case with multiple major versions and filtering out a single major version
func TestFilterMajorVersions(t *testing.T) {
versionStr := "v2.0.0\nv1.1.0\nv2.1.0-rc0\nv1.2.0\nv2.2.0\nv1.3.0"
versionStr := "v2.0.0 v1.1.0 v2.1.0-rc0 v1.2.0 v2.2.0 v1.3.0"
versions := e2e.ParseVersions(versionStr)
require.Len(t, versions, 6)
require.Len(t, versions.FilterMajor(1), 3)
}

// Test case to check the Order function
cmwaters marked this conversation as resolved.
Show resolved Hide resolved
func TestOrder(t *testing.T) {
versionStr := "v1.3.0\nv1.1.0\nv1.2.0-rc0\nv1.4.0\nv1.2.1\nv2.0.0"
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.Order()
require.Equal(t, versions[0], e2e.Version{1, 1, 0, false, 0})
Expand All @@ -40,7 +40,7 @@ func TestOrder(t *testing.T) {
}

func TestOrderOfReleaseCandidates(t *testing.T) {
versionsStr := "v1.0.0\nv1.0.0-rc0\nv1.0.0-rc1\n"
versionsStr := "v1.0.0 v1.0.0-rc0 v1.0.0-rc1 "
cmwaters marked this conversation as resolved.
Show resolved Hide resolved
versions := e2e.ParseVersions(versionsStr)
versions.Order()
require.Equal(t, versions[0], e2e.Version{1, 0, 0, true, 0})
Expand Down
Loading