Skip to content

Commit

Permalink
Fix test-cases
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishekdwivedi3060 committed Nov 27, 2023
1 parent 7f21e86 commit c5fcbcc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
12 changes: 11 additions & 1 deletion test/cluster_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ func rollingRestartClusterByUpdatingNamespaceStorageTest(

// Change namespace storage-engine
namespaceConfig := aeroCluster.Spec.AerospikeConfig.Value["namespaces"].([]interface{})[0].(map[string]interface{})
namespaceConfig["storage-engine"].(map[string]interface{})["data-in-memory"] = true
namespaceConfig["storage-engine"].(map[string]interface{})["filesize"] = 2000000000
aeroCluster.Spec.AerospikeConfig.Value["namespaces"].([]interface{})[0] = namespaceConfig

Expand Down Expand Up @@ -1467,6 +1466,17 @@ func getNonSCInMemoryNamespaceConfig(name string) map[string]interface{} {
}
}

func getNonSCInMemoryNamespaceConfigPre700(name string) map[string]interface{} {
return map[string]interface{}{
"name": name,
"replication-factor": 2,
"memory-size": 1073741824,
"storage-engine": map[string]interface{}{
"type": "memory",
},
}
}

func getNonSCNamespaceConfig(name, path string) map[string]interface{} {
return getNonSCNamespaceConfigWithRF(name, path, 2)
}
Expand Down
24 changes: 14 additions & 10 deletions test/storage_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +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"
)

const (
Expand Down Expand Up @@ -761,7 +762,7 @@ func getStorageInitAerospikeCluster(
image string,
) *asdbv1.AerospikeCluster {
// create Aerospike custom resource
return &asdbv1.AerospikeCluster{
aerospike := &asdbv1.AerospikeCluster{
ObjectMeta: metav1.ObjectMeta{
Name: clusterNamespacedName.Name,
Namespace: clusterNamespacedName.Namespace,
Expand Down Expand Up @@ -802,20 +803,23 @@ func getStorageInitAerospikeCluster(
"network": getNetworkConfig(),
"security": map[string]interface{}{},
"namespaces": []interface{}{
map[string]interface{}{
"name": "test",
"replication-factor": storageInitTestClusterSize,
"migrate-sleep": 0,
"storage-engine": map[string]interface{}{
"type": "memory",
"data-size": 1073741824,
},
},
getNonSCInMemoryNamespaceConfig("test"),
},
},
},
},
}

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

if ov < 0 {
aerospike.Spec.AerospikeConfig.Value["namespaces"] = []interface{}{
getNonSCInMemoryNamespaceConfigPre700("test"),
}
}

return aerospike
}

func getLongInitStorageConfig(
Expand Down

0 comments on commit c5fcbcc

Please sign in to comment.