Some checks failed
CodeQL / Analyze (push) Waiting to run
Docker Build & Push Simapp (main) / docker-build (push) Waiting to run
golangci-lint / lint (push) Waiting to run
Tests / Code Coverage / build (amd64) (push) Waiting to run
Tests / Code Coverage / build (arm64) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[additional-args:-tags="test_e2e" name:e2e path:./e2e]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:08-wasm path:./modules/light-clients/08-wasm]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:ibc-go path:.]) (push) Waiting to run
Deploy to GitHub Pages / Deploy to GitHub Pages (push) Has been cancelled
Buf-Push / push (push) Has been cancelled
54 lines
1.6 KiB
Go
54 lines
1.6 KiB
Go
package semverutil_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/cosmos/ibc-go/e2e/semverutil"
|
|
)
|
|
|
|
func TestIsSupported(t *testing.T) {
|
|
releases := semverutil.FeatureReleases{
|
|
MajorVersion: "v6",
|
|
MinorVersions: []string{
|
|
"v2.5",
|
|
"v3.4",
|
|
"v4.2",
|
|
"v5.1",
|
|
},
|
|
}
|
|
|
|
testCases := []struct {
|
|
name string
|
|
version string
|
|
expSupported bool
|
|
}{
|
|
{"non semantic version", "main", true},
|
|
{"non semantic version starts with v", "v", true},
|
|
{"non semantic version", "pr-155", true},
|
|
{"non semantic version", "major.5.1", true},
|
|
{"non semantic version", "1.minor.1", true},
|
|
{"supported semantic version", "v2.5.0", true},
|
|
{"supported semantic version", "v3.4.0", true},
|
|
{"supported semantic version", "v4.2.0", true},
|
|
{"supported semantic version", "v5.1.0", true},
|
|
{"supported semantic version", "v6.0.0", true},
|
|
{"supported semantic version", "v6.1.0", true},
|
|
{"supported semantic version", "v7.1.0", true},
|
|
{"supported semantic version", "v22.5.1", true},
|
|
{"supported semantic version pre-release", "v6.0.0-rc.0", false},
|
|
{"supported semantic version without v", "2.5.0", true},
|
|
{"unsupported semantic version", "v1.5.0", false},
|
|
{"unsupported semantic version", "v2.4.5", false},
|
|
{"unsupported semantic version", "v3.1.0", false},
|
|
{"unsupported semantic version", "v4.1.0", false},
|
|
{"unsupported semantic version", "v5.0.0", false},
|
|
{"unsupported semantic version on partially supported major line", "v2.4.0", false},
|
|
}
|
|
|
|
for _, tc := range testCases {
|
|
supported := releases.IsSupported(tc.version)
|
|
require.Equal(t, tc.expSupported, supported, tc.name)
|
|
}
|
|
}
|