Skip to content

Commit

Permalink
fixing dynamic config tests to check for latest schema
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmayja committed May 21, 2024
1 parent d714b2b commit 381c8af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions test/cluster_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const (
post6Version = "7.0.0.0"
pre6Version = "5.7.0.17"
version6 = "6.0.0.5"

latestSchemaVersion = "7.1.0"
)

var (
Expand Down
19 changes: 13 additions & 6 deletions test/dynamic_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ type podID struct {

const clName = "dynamic-config-test"

var configWithMaxDefaultVal = mapset.NewSet("info-max-ms", "flush-max-ms")
var (
configWithMaxDefaultVal = mapset.NewSet("info-max-ms", "flush-max-ms")
configWithPow2Val = mapset.NewSet("flush-size", "transaction-queue-limit")
configWithMul100Val = mapset.NewSet("max-throughput")
)

var _ = Describe(
"DynamicConfig", func() {
Expand Down Expand Up @@ -532,7 +536,7 @@ var _ = Describe(
podPIDMap, err := getPodIDs(ctx, aeroCluster)
Expect(err).ToNot(HaveOccurred())

dynamic, err := asconfig.GetDynamic("7.0.0")
dynamic, err := asconfig.GetDynamic(latestSchemaVersion)
Expect(err).ToNot(HaveOccurred())

flatServer, flatSpec, err := getAerospikeConfigFromNodeAndSpec(aeroCluster)
Expand Down Expand Up @@ -801,8 +805,11 @@ func validateNamespaceContextDynamically(
}

if v != nil {
if configWithMaxDefaultVal.Contains(asconfig.BaseKey(confKey)) {
switch {
case configWithMaxDefaultVal.Contains(asconfig.BaseKey(confKey)):
v = v.(int64) - 1
case configWithPow2Val.Contains(asconfig.BaseKey(confKey)):
v = (v.(int64) - 1) * 2
}

newSpec[confKey] = v
Expand Down Expand Up @@ -900,10 +907,10 @@ func validateXDRNSFieldsDynamically(ctx goctx.Context, flatServer, flatSpec *asc
}

if v != nil {
switch asconfig.BaseKey(confKey) {
case "max-throughput":
switch {
case configWithMul100Val.Contains(asconfig.BaseKey(confKey)):
v = v.(int64) + 99
case "transaction-queue-limit":
case configWithPow2Val.Contains(asconfig.BaseKey(confKey)):
v = (v.(int64) - 1) * 2
}

Expand Down

0 comments on commit 381c8af

Please sign in to comment.