Skip to content

Commit 3f95366

Browse files
committed
chore: fix flaky version featuresTest
1 parent 3507e53 commit 3f95366

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

argocd/features_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/argoproj/argo-cd/pkg/apiclient/version"
77
"github.com/stretchr/testify/assert"
88
"math/rand"
9+
"modernc.org/mathutil"
910
"testing"
1011
)
1112

@@ -36,9 +37,9 @@ func serverInterfaceTestData(t *testing.T, argocdVersion string, semverOperator
3637
case semverLess:
3738
v, err = semver.NewVersion(
3839
fmt.Sprintf("%d.%d.%d",
39-
v.Major()-incMajor%v.Major(),
40-
v.Minor()-incMinor%v.Minor(),
41-
v.Patch()-incPatch%v.Patch(),
40+
mathutil.MinInt64(v.Major(), v.Major()-incMajor%v.Major()),
41+
mathutil.MinInt64(v.Minor(), v.Minor()-incMinor%v.Minor()),
42+
mathutil.MinInt64(v.Patch(), v.Patch()-incPatch%v.Patch()),
4243
))
4344
assert.NoError(t, err)
4445
default:

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ require (
1414
github.com/stretchr/testify v1.5.1
1515
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586
1616
k8s.io/apimachinery v0.16.6
17+
modernc.org/mathutil v1.0.0
1718
)
1819

1920
replace (

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7q
586586
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
587587
github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI=
588588
github.com/quobyte/api v0.1.2/go.mod h1:jL7lIHrmqQ7yh05OJ+eEEdHr0u/kmT1Ff9iHd+4H6VI=
589+
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446 h1:/NRJ5vAYoqz+7sG51ubIDHXeWO8DlTSrToPu6q11ziA=
589590
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
590591
github.com/robfig/cron v1.1.0 h1:jk4/Hud3TTdcrJgUOBgsqrZBarcxl6ADIjSC2iniwLY=
591592
github.com/robfig/cron v1.1.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
@@ -967,6 +968,7 @@ k8s.io/utils v0.0.0-20191114200735-6ca3b61696b6/go.mod h1:sZAwmy6armz5eXlNoLmJcl
967968
layeh.com/gopher-json v0.0.0-20190114024228-97fed8db8427/go.mod h1:ivKkcY8Zxw5ba0jldhZCYYQfGdb2K6u9tbYK1AwMIBc=
968969
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
969970
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
971+
modernc.org/mathutil v1.0.0 h1:93vKjrJopTPrtTNpZ8XIovER7iCIH1QU7wNbOQXC60I=
970972
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
971973
modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
972974
modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I=

0 commit comments

Comments
 (0)