-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
requeue after the last node has its node-state label set to Started d…
…uring cluster creation (#77) * requeue after the last node has its node-state label set to Started This commit fixes an issue in which we basically see out of order status updates. Specifically, the .Status.SuperUserUpserted property is getting set before the last node is added to .Status.NodeStatuses. The actual order of operations is correct though. The super user is not created until all C* nodes are started. It is just that the status updates basically occur out of order. * add integration test (WIP) * fix file name * a few updates based on PR review * add comment
- Loading branch information
Showing
4 changed files
with
136 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
tests/scale_up_status_updates/scale_up_status_updates_suite_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package scale_up_status_updates | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
|
||
ginkgo_util "github.com/datastax/cass-operator/mage/ginkgo" | ||
"github.com/datastax/cass-operator/mage/kubectl" | ||
) | ||
|
||
var ( | ||
testName = "Scale up status updates" | ||
namespace = "test-scale-up-status-updates" | ||
dcName = "dc1" | ||
dcYaml = "../testdata/oss-two-rack-six-node-dc.yaml" | ||
operatorYaml = "../testdata/operator.yaml" | ||
dcResource = fmt.Sprintf("CassandraDatacenter/%s", dcName) | ||
dcLabel = fmt.Sprintf("cassandra.datastax.com/datacenter=%s", dcName) | ||
ns = ginkgo_util.NewWrapper(testName, namespace) | ||
) | ||
|
||
func TestLifecycle(t *testing.T) { | ||
AfterSuite(func() { | ||
logPath := fmt.Sprintf("%s/aftersuite", ns.LogDir) | ||
kubectl.DumpAllLogs(logPath).ExecV() | ||
fmt.Printf("\n\tPost-run logs dumped at: %s\n\n", logPath) | ||
ns.Terminate() | ||
}) | ||
|
||
RegisterFailHandler(Fail) | ||
RunSpecs(t, testName) | ||
} | ||
|
||
var _ = Describe(testName, func() { | ||
Context("when in a new cluster", func() { | ||
Specify("the operator can scale up a datacenter and does not upsert the super user until all nodes have been started", func() { | ||
By("creating a namespace") | ||
err := kubectl.CreateNamespace(namespace).ExecV() | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
step := "setting up cass-operator resources via helm chart" | ||
ns.HelmInstall("../../charts/cass-operator-chart") | ||
|
||
ns.WaitForOperatorReady() | ||
|
||
step = "creating a datacenter resource with 2 racks/6 nodes" | ||
k := kubectl.ApplyFiles(dcYaml) | ||
ns.ExecAndLog(step, k) | ||
|
||
ns.WaitForSuperUserUpserted(dcName, 600) | ||
|
||
step = "checking that all nodes have been started" | ||
nodeStatusesHostIds := ns.GetNodeStatusesHostIds(dcName) | ||
Expect(len(nodeStatusesHostIds), 6) | ||
|
||
step = "deleting the dc" | ||
k = kubectl.DeleteFromFiles(dcYaml) | ||
ns.ExecAndLog(step, k) | ||
|
||
step = "checking that the dc no longer exists" | ||
json := "jsonpath={.items}" | ||
k = kubectl.Get("CassandraDatacenter"). | ||
WithLabel(dcLabel). | ||
FormatOutput(json) | ||
ns.WaitForOutputAndLog(step, k, "[]", 300) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
apiVersion: cassandra.datastax.com/v1beta1 | ||
kind: CassandraDatacenter | ||
metadata: | ||
name: dc1 | ||
spec: | ||
clusterName: cluster1 | ||
serverType: cassandra | ||
serverVersion: "3.11.6" | ||
serverImage: datastax/cassandra-mgmtapi-3_11_6:v0.1.0 | ||
configBuilderImage: datastax/cass-config-builder:1.0.0 | ||
managementApiAuth: | ||
insecure: {} | ||
size: 6 | ||
storageConfig: | ||
cassandraDataVolumeClaimSpec: | ||
storageClassName: server-storage | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 1Gi | ||
racks: | ||
- name: r1 | ||
- name: r2 | ||
config: | ||
jvm-options: | ||
initial_heap_size: "800m" | ||
max_heap_size: "800m" |