-
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.
* Adding CheckRackForceUpgrade() * gofmt * Ran codegen * Adding an int test * Update crd in helm * Trying to deal with updating the release script * Fix codegen empty lines after merge
- Loading branch information
1 parent
1845cab
commit 86b869d
Showing
9 changed files
with
11,851 additions
and
17 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
96 changes: 96 additions & 0 deletions
96
tests/test_bad_config_and_fix/test_bad_config_and_fix_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,96 @@ | ||
// Copyright DataStax, Inc. | ||
// Please see the included license file for details. | ||
|
||
package test_bad_config_and_fix | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
"time" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
|
||
corev1 "k8s.io/api/core/v1" | ||
|
||
ginkgo_util "github.com/datastax/cass-operator/mage/ginkgo" | ||
"github.com/datastax/cass-operator/mage/kubectl" | ||
) | ||
|
||
var ( | ||
testName = "test rolling out a bad config and fixing it" | ||
namespace = "test-bad-config-and-fix" | ||
dcName = "dc1" | ||
dcYaml = "../testdata/oss-three-rack-three-node-dc.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, stop, resume, and terminate a datacenter", 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 3 racks/3 nodes" | ||
k := kubectl.ApplyFiles(dcYaml) | ||
ns.ExecAndLog(step, k) | ||
|
||
ns.WaitForDatacenterReady(dcName) | ||
ns.WaitForDatacenterCondition(dcName, "Ready", string(corev1.ConditionTrue)) | ||
ns.WaitForDatacenterCondition(dcName, "Initialized", string(corev1.ConditionTrue)) | ||
|
||
step = "apply a bad image" | ||
json := "{\"spec\": {\"serverImage\": \"datastax/cassandra-v314159\"}}" | ||
k = kubectl.PatchMerge(dcResource, json) | ||
ns.ExecAndLog(step, k) | ||
|
||
ns.WaitForDatacenterOperatorProgress(dcName, "Updating", 30) | ||
|
||
time.Sleep(time.Minute * 6) | ||
ns.WaitForDatacenterReadyPodCount(dcName, 2) | ||
|
||
step = "apply a good image" | ||
json = "{\"spec\": {\"serverImage\": \"\"}}" | ||
k = kubectl.PatchMerge(dcResource, json) | ||
ns.ExecAndLog(step, k) | ||
|
||
step = "set the forceUpgradeRacks config" | ||
json = "{\"spec\": {\"forceUpgradeRacks\": [\"r1\"]}}" | ||
k = kubectl.PatchMerge(dcResource, json) | ||
ns.ExecAndLog(step, k) | ||
|
||
ns.WaitForDatacenterReady(dcName) | ||
|
||
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) | ||
}) | ||
}) | ||
}) |