Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions test/e2e/fixture/scylla/nondevmode.scyllacluster.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apiVersion: scylla.scylladb.com/v1
kind: ScyllaCluster
metadata:
generateName: basic-
labels:
foo: bar
annotations:
bar: foo
spec:
agentVersion: "{{ .scyllaDBManagerVersion }}"
repository: "{{ .scyllaDBRepository }}"
version: "{{ .scyllaDBVersion }}"
developerMode: false
{{- if .scyllaArgs }}
scyllaArgs: "{{ join .scyllaArgs " " }}"
{{- end }}
exposeOptions:
nodeService:
type: {{ .nodeServiceType }}
broadcastOptions:
nodes:
type: {{ .nodesBroadcastAddressType }}
clients:
type: {{ .clientsBroadcastAddressType }}
datacenter:
name: us-east-1
racks:
- name: us-east-1a
members: 1
storage:
capacity: 11Gi
{{- if .storageClassName }}
storageClassName: {{ .storageClassName }}
{{- end }}
resources:
requests:
cpu: 10m
memory: 100Mi
limits:
cpu: 1
memory: 3Gi
placement:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: scylla.scylladb.com/node-type
operator: In
values:
- scylla
tolerations:
- effect: NoSchedule
key: scylla-operator.scylladb.com/dedicated
operator: Equal
value: scyllaclusters
4 changes: 4 additions & 0 deletions test/e2e/fixture/scylla/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ var (
ScyllaClusterTemplateString string
ScyllaClusterTemplate = ParseObjectTemplateOrDie[*scyllav1.ScyllaCluster]("scyllacluster", ScyllaClusterTemplateString)

//go:embed "nondevmode.scyllacluster.yaml.tmpl"
NonDevModeScyllaClusterTemplateString string
NonDevModeScyllaClusterTemplate = ParseObjectTemplateOrDie[*scyllav1.ScyllaCluster]("nondevmode-scyllacluster", NonDevModeScyllaClusterTemplateString)

//go:embed "zonal.scyllacluster.yaml.tmpl"
ZonalScyllaClusterTemplateString string
ZonalScyllaClusterTemplate = ParseObjectTemplateOrDie[*scyllav1.ScyllaCluster]("zonal-scyllacluster", ZonalScyllaClusterTemplateString)
Expand Down
19 changes: 19 additions & 0 deletions test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,25 @@ func (f *Framework) GetDefaultScyllaCluster() *scyllav1.ScyllaCluster {
return sc
}

func (f *Framework) GetNonDevModeScyllaCluster() *scyllav1.ScyllaCluster {
scyllaDBRepository, scyllaDBVersion := scyllaDBTargetRepositoryVersion()
renderArgs := map[string]any{
"scyllaDBRepository": scyllaDBRepository,
"scyllaDBVersion": scyllaDBVersion,
"scyllaDBManagerVersion": TestContext.ScyllaDBManagerAgentVersion,
"nodeServiceType": TestContext.ScyllaClusterOptions.ExposeOptions.NodeServiceType,
"nodesBroadcastAddressType": TestContext.ScyllaClusterOptions.ExposeOptions.NodesBroadcastAddressType,
"clientsBroadcastAddressType": TestContext.ScyllaClusterOptions.ExposeOptions.ClientsBroadcastAddressType,
"storageClassName": TestContext.ScyllaClusterOptions.StorageClassName,
"scyllaArgs": TestContext.ScyllaClusterOptions.ScyllaArgs(),
}

sc, _, err := scyllafixture.NonDevModeScyllaClusterTemplate.RenderObject(renderArgs)
o.Expect(err).NotTo(o.HaveOccurred())

return sc
}

func (f *Framework) GetDefaultZonalScyllaClusterWithThreeRacks() *scyllav1.ScyllaCluster {
scyllaDBRepository, scyllaDBVersion := scyllaDBTargetRepositoryVersion()
renderArgs := map[string]any{
Expand Down
76 changes: 76 additions & 0 deletions test/e2e/set/scyllacluster/scyllacluster_updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
g "github.com/onsi/ginkgo/v2"
o "github.com/onsi/gomega"
"github.com/scylladb/scylla-operator/pkg/controllerhelpers"
"github.com/scylladb/scylla-operator/pkg/naming"
"github.com/scylladb/scylla-operator/test/e2e/framework"
"github.com/scylladb/scylla-operator/test/e2e/utils"
"github.com/scylladb/scylla-operator/test/e2e/utils/verification"
Expand Down Expand Up @@ -211,3 +212,78 @@ var _ = g.Describe("ScyllaCluster", framework.SuiteParallel, framework.SuitePara
verification.VerifyCQLData(ctx, di)
})
})

var _ = g.Describe("ScyllaCluster", framework.SuiteSerial, framework.SuiteKindFast, func() {
var f *framework.Framework

g.BeforeEach(func(ctx context.Context) {
f = framework.NewFramework(ctx, "scyllacluster")
})

g.It("should skip iotune on restart when io properties are cached", func() {
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
defer cancel()

framework.By("Creating a ScyllaCluster with developer mode disabled")
sc := f.GetNonDevModeScyllaCluster()
sc.Spec.Datacenter.Racks[0].Members = 1

sc, err := f.ScyllaClient().ScyllaV1().ScyllaClusters(f.Namespace()).Create(ctx, sc, metav1.CreateOptions{})
o.Expect(err).NotTo(o.HaveOccurred())

framework.By("Waiting for the ScyllaCluster to roll out (RV=%s)", sc.ResourceVersion)
waitCtx1, waitCtx1Cancel := utils.ContextForRollout(ctx, sc)
defer waitCtx1Cancel()
sc, err = controllerhelpers.WaitForScyllaClusterState(waitCtx1, f.ScyllaClient().ScyllaV1().ScyllaClusters(sc.Namespace), sc.Name, controllerhelpers.WaitForStateOptions{}, utils.IsScyllaClusterRolledOut)
o.Expect(err).NotTo(o.HaveOccurred())

scyllaclusterverification.Verify(ctx, f.KubeClient(), f.ScyllaClient(), sc)
scyllaclusterverification.WaitForFullQuorum(ctx, f.KubeClient().CoreV1(), sc)

pod, err := f.KubeClient().CoreV1().Pods(f.Namespace()).Get(
ctx,
utils.GetNodeName(sc, 0),
metav1.GetOptions{},
)
o.Expect(err).NotTo(o.HaveOccurred())
initialPodUID := pod.UID
framework.Infof("Initial pod %q UID is %q", pod.Name, initialPodUID)

framework.By("Restarting the ScyllaDB Pod")
err = f.KubeClient().CoreV1().Pods(f.Namespace()).Delete(ctx, pod.Name, metav1.DeleteOptions{
Preconditions: &metav1.Preconditions{
UID: &initialPodUID,
},
})
o.Expect(err).NotTo(o.HaveOccurred())

framework.By("Waiting for the ScyllaCluster to roll out (RV=%s)", sc.ResourceVersion)
waitCtx2, waitCtx2Cancel := utils.ContextForRollout(ctx, sc)
defer waitCtx2Cancel()
sc, err = controllerhelpers.WaitForScyllaClusterState(waitCtx2, f.ScyllaClient().ScyllaV1().ScyllaClusters(sc.Namespace), sc.Name, controllerhelpers.WaitForStateOptions{}, utils.IsScyllaClusterRolledOut)
o.Expect(err).NotTo(o.HaveOccurred())

scyllaclusterverification.Verify(ctx, f.KubeClient(), f.ScyllaClient(), sc)
scyllaclusterverification.WaitForFullQuorum(ctx, f.KubeClient().CoreV1(), sc)

pod, err = f.KubeClient().CoreV1().Pods(f.Namespace()).Get(
ctx,
utils.GetNodeName(sc, 0),
metav1.GetOptions{},
)
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(pod.UID).NotTo(o.Equal(initialPodUID))

framework.By("Verifying that iotune was skipped on restart")
stdout, stderr, err := utils.ExecWithOptions(ctx, f.ClientConfig(), f.KubeClient().CoreV1(), utils.ExecOptions{
Command: []string{"sh", "-c", "cat /proc/$(pgrep -x scylla)/cmdline | tr '\\0' ' '"},
Namespace: f.Namespace(),
PodName: pod.Name,
ContainerName: naming.ScyllaContainerName,
CaptureStdout: true,
CaptureStderr: true,
})
o.Expect(err).NotTo(o.HaveOccurred(), "failed to get scylla process args: %s", stderr)
o.Expect(stdout).To(o.ContainSubstring("--io-setup=0"), "expected iotune to be skipped on restart, but --io-setup=0 flag is missing from scylla process args: %s", stdout)
})
})