Merge pull request #15632 from serathius/fix-comparing-etcd-version

tests: Fix comparing etcd version
This commit is contained in:
Marek Siarkowicz 2023-04-04 09:34:55 +02:00 committed by GitHub
commit 138fae6246
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -364,7 +364,15 @@ func GetVersionFromBinary(binaryPath string) (*semver.Version, error) {
for _, line := range lines { for _, line := range lines {
if strings.HasPrefix(line, "etcd Version:") { if strings.HasPrefix(line, "etcd Version:") {
versionString := strings.TrimSpace(strings.SplitAfter(line, ":")[1]) versionString := strings.TrimSpace(strings.SplitAfter(line, ":")[1])
return semver.NewVersion(versionString) version, err := semver.NewVersion(versionString)
if err != nil {
return nil, err
}
return &semver.Version{
Major: version.Major,
Minor: version.Minor,
Patch: version.Patch,
}, nil
} }
} }

View File

@ -147,7 +147,7 @@ func TestRobustness(t *testing.T) {
e2e.WithPeerProxy(true), e2e.WithPeerProxy(true),
e2e.WithIsPeerTLS(true), e2e.WithIsPeerTLS(true),
} }
if !v.LessThan(version.V3_6) { if v.Compare(version.V3_6) >= 0 {
snapshotOptions = append(snapshotOptions, e2e.WithSnapshotCatchUpEntries(100)) snapshotOptions = append(snapshotOptions, e2e.WithSnapshotCatchUpEntries(100))
} }
scenarios = append(scenarios, scenario{ scenarios = append(scenarios, scenario{