Skip to content

Commit

Permalink
test new mangemant-lib code changes (#266)
Browse files Browse the repository at this point in the history
* Update management-lib SHA

---------

Co-authored-by: Sudhanshu Ranjan <[email protected]>
  • Loading branch information
abhishekdwivedi3060 and sud82 authored Jan 2, 2024
1 parent 30993ed commit 07b0ef0
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 30 deletions.
6 changes: 3 additions & 3 deletions api/v1/access_control_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net"
"strings"

"github.com/aerospike/aerospike-management-lib/asconfig"
lib "github.com/aerospike/aerospike-management-lib"
)

// PrivilegeScope enumerates valid scopes for privileges.
Expand Down Expand Up @@ -213,7 +213,7 @@ func isRoleSpecValid(

_, ok := PredefinedRoles[roleSpec.Name]
if ok {
cmp, err := asconfig.CompareVersions(version, "6.0.0.0")
cmp, err := lib.CompareVersions(version, "6.0.0.0")
if err != nil {
return false, err
}
Expand Down Expand Up @@ -319,7 +319,7 @@ func isPrivilegeValid(
}

// Check if new privileges are used in an older version.
cmp, err := asconfig.CompareVersions(version, "6.0.0.0")
cmp, err := lib.CompareVersions(version, "6.0.0.0")
if err != nil {
return false, err
}
Expand Down
11 changes: 6 additions & 5 deletions api/v1/aerospikecluster_validating_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"regexp"
"strings"

lib "github.com/aerospike/aerospike-management-lib"
validate "github.com/asaskevich/govalidator"
"github.com/go-logr/logr"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -173,7 +174,7 @@ func (c *AerospikeCluster) validate(aslog logr.Logger) error {
return err
}

val, err := asconfig.CompareVersions(version, baseVersion)
val, err := lib.CompareVersions(version, baseVersion)
if err != nil {
return fmt.Errorf("failed to check image version: %v", err)
}
Expand Down Expand Up @@ -696,7 +697,7 @@ const maxEnterpriseClusterSzGt5_0 = 256
const versionForSzCheck = "5.0.0"

func validateClusterSize(_ logr.Logger, version string, sz int) error {
val, err := asconfig.CompareVersions(version, versionForSzCheck)
val, err := lib.CompareVersions(version, versionForSzCheck)
if err != nil {
return fmt.Errorf(
"failed to validate cluster size limit from version: %v", err,
Expand Down Expand Up @@ -1288,12 +1289,12 @@ func validateLoadBalancerUpdate(
func validateSecurityConfigUpdate(
newVersion, oldVersion string, newSpec, oldSpec *AerospikeConfigSpec,
) error {
nv, err := asconfig.CompareVersions(newVersion, "5.7.0")
nv, err := lib.CompareVersions(newVersion, "5.7.0")
if err != nil {
return err
}

ov, err := asconfig.CompareVersions(oldVersion, "5.7.0")
ov, err := lib.CompareVersions(oldVersion, "5.7.0")
if err != nil {
return err
}
Expand Down Expand Up @@ -1778,7 +1779,7 @@ func validateRequiredFileStorageForMetadata(
}

if !validationPolicy.SkipXdrDlogFileValidate {
val, err := asconfig.CompareVersions(version, "5.0.0")
val, err := lib.CompareVersions(version, "5.0.0")
if err != nil {
return fmt.Errorf("failed to check image version: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions api/v1/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
v1 "k8s.io/api/core/v1"

internalerrors "github.com/aerospike/aerospike-kubernetes-operator/errors"
"github.com/aerospike/aerospike-management-lib/asconfig"
lib "github.com/aerospike/aerospike-management-lib"
)

const (
Expand Down Expand Up @@ -188,7 +188,7 @@ func IsServiceTLSEnabled(aerospikeConfigSpec *AerospikeConfigSpec) bool {
func IsSecurityEnabled(
version string, aerospikeConfig *AerospikeConfigSpec,
) (bool, error) {
retval, err := asconfig.CompareVersions(version, "5.7.0")
retval, err := lib.CompareVersions(version, "5.7.0")
if err != nil {
return false, err
}
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ go 1.19

require (
github.com/aerospike/aerospike-client-go/v6 v6.14.0
github.com/aerospike/aerospike-management-lib v0.0.0-20231129055344-b6aff63f1dbb
github.com/aerospike/aerospike-management-lib v0.0.0-20231229132959-08273f7a41b7
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/evanphx/json-patch v4.12.0+incompatible
github.com/go-logr/logr v1.2.4
github.com/onsi/ginkgo/v2 v2.9.5
github.com/onsi/gomega v1.27.7
github.com/stretchr/testify v1.8.3
github.com/stretchr/testify v1.8.4
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/term v0.15.0 // indirect
k8s.io/api v0.27.2
Expand Down Expand Up @@ -82,7 +82,7 @@ require (
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.9.1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
Expand Down
13 changes: 8 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk=
github.com/aerospike/aerospike-client-go/v6 v6.14.0 h1:Z3FcGWJda1sagzdc6Akz4EJ13Pq55Uyn6qtFLrVUDd0=
github.com/aerospike/aerospike-client-go/v6 v6.14.0/go.mod h1:/0Wm81GhMqem+9flWcpazPKoRfjFeG6WrQdXGiMNi0A=
github.com/aerospike/aerospike-management-lib v0.0.0-20231129055344-b6aff63f1dbb h1:ykX3ElBNT/VOUhw/+5+jiFnWw3LSbPfl6eRrhQzBBFk=
github.com/aerospike/aerospike-management-lib v0.0.0-20231129055344-b6aff63f1dbb/go.mod h1:LPOsGG8okRSH4hN9Y8VXFzsfIpBDj2WKEsI/f6wxwaw=
github.com/aerospike/aerospike-management-lib v0.0.0-20231229132959-08273f7a41b7 h1:D+/s/d6l26SRACLJlegmgE35o0qWBjLcYcuB14UhnDc=
github.com/aerospike/aerospike-management-lib v0.0.0-20231229132959-08273f7a41b7/go.mod h1:54II0rXTkJ6Pi7MTR7bCSlQXPCdHr/kqR3aUuKht6sY=
github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY=
github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk=
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
Expand Down Expand Up @@ -909,8 +909,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
Expand Down Expand Up @@ -944,6 +945,7 @@ go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo=
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
Expand Down Expand Up @@ -1014,7 +1016,7 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -1161,8 +1163,9 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down
9 changes: 4 additions & 5 deletions test/cluster_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
internalerrors "github.com/aerospike/aerospike-kubernetes-operator/errors"
"github.com/aerospike/aerospike-kubernetes-operator/pkg/utils"
lib "github.com/aerospike/aerospike-management-lib"
"github.com/aerospike/aerospike-management-lib/asconfig"
"github.com/aerospike/aerospike-management-lib/info"
)

Expand Down Expand Up @@ -1071,12 +1070,12 @@ func UpdateClusterImage(
return err
}

ov, err := asconfig.CompareVersions(outgoingVersion, "7.0.0")
ov, err := lib.CompareVersions(outgoingVersion, "7.0.0")
if err != nil {
return err
}

nv, err := asconfig.CompareVersions(incomingVersion, "7.0.0")
nv, err := lib.CompareVersions(incomingVersion, "7.0.0")
if err != nil {
return err
}
Expand Down Expand Up @@ -1120,12 +1119,12 @@ func UpdateClusterImage(
}
}

ov, err = asconfig.CompareVersions(outgoingVersion, "5.7.0")
ov, err = lib.CompareVersions(outgoingVersion, "5.7.0")
if err != nil {
return err
}

nv, err = asconfig.CompareVersions(incomingVersion, "5.7.0")
nv, err = lib.CompareVersions(incomingVersion, "5.7.0")
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions test/storage_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1"
"github.com/aerospike/aerospike-kubernetes-operator/pkg/jsonpatch"
"github.com/aerospike/aerospike-kubernetes-operator/pkg/utils"
"github.com/aerospike/aerospike-management-lib/asconfig"
lib "github.com/aerospike/aerospike-management-lib"
)

const (
Expand Down Expand Up @@ -811,7 +811,7 @@ func getStorageInitAerospikeCluster(
}

version, _ := asdbv1.GetImageVersion(image)
ov, _ := asconfig.CompareVersions(version, "7.0.0")
ov, _ := lib.CompareVersions(version, "7.0.0")

if ov < 0 {
aerospike.Spec.AerospikeConfig.Value["namespaces"] = []interface{}{
Expand Down
10 changes: 5 additions & 5 deletions test/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1"
operatorUtils "github.com/aerospike/aerospike-kubernetes-operator/pkg/utils"
"github.com/aerospike/aerospike-management-lib/asconfig"
lib "github.com/aerospike/aerospike-management-lib"
)

var (
Expand Down Expand Up @@ -491,7 +491,7 @@ func (acs *AerospikeConfSpec) getVersion() string {
}

func (acs *AerospikeConfSpec) setEnableSecurity(enableSecurity bool) error {
cmpVal, err := asconfig.CompareVersions(acs.version, "5.7.0")
cmpVal, err := lib.CompareVersions(acs.version, "5.7.0")
if err != nil {
return err
}
Expand All @@ -512,7 +512,7 @@ func (acs *AerospikeConfSpec) setEnableSecurity(enableSecurity bool) error {
}

func (acs *AerospikeConfSpec) setEnableQuotas(enableQuotas bool) error {
cmpVal, err := asconfig.CompareVersions(acs.version, "5.6.0")
cmpVal, err := lib.CompareVersions(acs.version, "5.6.0")
if err != nil {
return err
}
Expand Down Expand Up @@ -566,12 +566,12 @@ func getAeroClusterConfig(
return nil, err
}

cmpVal1, err := asconfig.CompareVersions(version, "5.7.0")
cmpVal1, err := lib.CompareVersions(version, "5.7.0")
if err != nil {
return nil, err
}

cmpVal2, err := asconfig.CompareVersions(version, "7.0.0")
cmpVal2, err := lib.CompareVersions(version, "7.0.0")
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 07b0ef0

Please sign in to comment.