mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-08 22:23:11 +00:00
* ci: Add missing group to manual E2E workflow Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Improve help for multi-version CLI param Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Rename multiversion to multiVersion Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Extract generator params into struct Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Add support for more than 2 versions in multi-version tests Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Add generator logic to extract latest release tag from Git repo Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Cater for "dev-" prefixes in tags Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Add sophisticated weighted version parsing to generator Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Add note to E2E readme about multi-version testing Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Expand on Docker image comment in readme Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Print node version weights when generating testnets Signed-off-by: Thane Thomson <connect@thanethomson.com> * ci: Add manual E2E workflow to run multi-version tests Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Replace "HEAD" keyword with "local" Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Update readme to reflect "HEAD" -> "local" keyword change and expand on examples Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Clarify comment relating to Docker image versions Signed-off-by: Thane Thomson <connect@thanethomson.com> * Apply suggestions from code review Co-authored-by: Sergio Mena <sergio@informal.systems> * e2e: Skip invalid tags instead of erroring in generator Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Add comment in version selection code Signed-off-by: Thane Thomson <connect@thanethomson.com> * ci: Replace "HEAD" with "local" keyword in multiversion workflow Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Use error format specifier when returning wrapped error Signed-off-by: Thane Thomson <connect@thanethomson.com> Signed-off-by: Thane Thomson <connect@thanethomson.com> Co-authored-by: Sergio Mena <sergio@informal.systems>
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestVersionFinder(t *testing.T) {
|
|
testCases := []struct {
|
|
baseVer string
|
|
tags []string
|
|
expectedLatest string
|
|
}{
|
|
{
|
|
baseVer: "v0.34.0",
|
|
tags: []string{"v0.34.0", "v0.34.1", "v0.34.2", "v0.34.3-rc1", "v0.34.3", "v0.35.0", "v0.35.1", "v0.36.0-rc1"},
|
|
expectedLatest: "v0.34.3",
|
|
},
|
|
{
|
|
baseVer: "v0.38.0-dev",
|
|
tags: []string{"v0.34.0", "v0.34.1", "v0.34.2", "v0.37.0-rc2", "dev-v0.38.0"},
|
|
expectedLatest: "",
|
|
},
|
|
{
|
|
baseVer: "v0.37.1-rc1",
|
|
tags: []string{"v0.36.0", "v0.37.0-rc1", "v0.37.0"},
|
|
expectedLatest: "v0.37.0",
|
|
},
|
|
{
|
|
baseVer: "v1.0.0",
|
|
tags: []string{"v0.34.0", "v0.35.0", "v1.0.0", "v1.0.1"},
|
|
expectedLatest: "v1.0.1",
|
|
},
|
|
{
|
|
baseVer: "v1.1.5",
|
|
tags: []string{"v0.35.0", "v1.0.0", "v1.0.1", "v1.1.1", "v1.1.2", "v1.1.3", "v1.1.4"},
|
|
expectedLatest: "v1.1.4",
|
|
},
|
|
}
|
|
for _, tc := range testCases {
|
|
actualLatest, err := findLatestReleaseTag(tc.baseVer, tc.tags)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, tc.expectedLatest, actualLatest)
|
|
}
|
|
}
|