Skip to content

Commit

Permalink
test(e2e): filter out retracted version
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp committed Dec 13, 2024
1 parent b0cf504 commit 5ba00b1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
16 changes: 13 additions & 3 deletions test/e2e/minor_version_compatibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/celestiaorg/celestia-app/v3/app"
v1 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v1"
v2 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v2"
v3 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v3"
"github.com/celestiaorg/celestia-app/v3/test/e2e/testnet"
"github.com/celestiaorg/knuu/pkg/knuu"
)
Expand All @@ -22,13 +23,22 @@ func MinorVersionCompatibility(logger *log.Logger) error {
const (
testName = "MinorVersionCompatibility"
numNodes = 4
// retractedCelestiaApp is a version of celestia-app that was retracted.
retractedCelestiaApp = "v1.8.0"
)

versionStr, err := getAllVersions()
testnet.NoError("failed to get versions", err)
versions1 := testnet.ParseVersions(versionStr).FilterMajor(v1.Version).FilterOutReleaseCandidates()
versions2 := testnet.ParseVersions(versionStr).FilterMajor(v2.Version) // include release candidates for v2 because there isn't an official release yet.
versions := slices.Concat(versions1, versions2)

retracted, ok := testnet.ParseVersion(retractedCelestiaApp)
if !ok {
logger.Fatal("failed to parse retracted version")
}

versions1 := testnet.ParseVersions(versionStr).FilterMajor(v1.Version).FilterOutReleaseCandidates().FilterOut(retracted)
versions2 := testnet.ParseVersions(versionStr).FilterMajor(v2.Version).FilterOutReleaseCandidates()
versions3 := testnet.ParseVersions(versionStr).FilterMajor(v3.Version).FilterOutReleaseCandidates()
versions := slices.Concat(versions1, versions2, versions3)

if len(versions) == 0 {
logger.Fatal("no versions to test")
Expand Down
10 changes: 10 additions & 0 deletions test/e2e/testnet/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ func (v VersionSet) FilterOutReleaseCandidates() VersionSet {
return output
}

func (v VersionSet) FilterOut(retracted Version) VersionSet {
output := make(VersionSet, 0, len(v))
for _, version := range v {
if version != retracted {
output = append(output, version)
}
}
return output
}

func (v VersionSet) GetLatest() Version {
latest := Version{}
for _, version := range v {
Expand Down

0 comments on commit 5ba00b1

Please sign in to comment.