Skip to content

Commit

Permalink
chore: add Zookeeper/MariaDB e2e test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
linghan-hub committed Oct 30, 2023
1 parent 55e4d58 commit a7cbf2d
Show file tree
Hide file tree
Showing 16 changed files with 281 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,14 @@ else ifeq ($(TEST_TYPE), clickhouse)
$(HELM) dependency build deploy/clickhouse-cluster --skip-refresh
$(HELM) upgrade --install clickhouse deploy/clickhouse
$(HELM) template test -s templates/cluster.yaml deploy/clickhouse-cluster > test/e2e/testdata/smoketest/clickhouse/00_clickhousecluster.yaml
else ifeq ($(TEST_TYPE), zookeeper)
$(HELM) dependency build deploy/zookeeper-cluster --skip-refresh
$(HELM) upgrade --install zookeeper deploy/zookeeper
$(HELM) template zk-cluster deploy/zookeeper-cluster > test/e2e/testdata/smoketest/zookeeper/00_zookeepercluster.yaml
else ifeq ($(TEST_TYPE), mariadb)
$(HELM) dependency build deploy/mariadb-cluster --skip-refresh
$(HELM) upgrade --install mariadb deploy/mariadb
$(HELM) template mariadb-cluster deploy/mariadb-cluster > test/e2e/testdata/smoketest/mariadb/00_mariadbcluster.yaml
else
$(error "test type does not exist")
endif
Expand Down Expand Up @@ -766,6 +774,10 @@ else ifeq ($(TEST_TYPE), milvus)
$(HELM) upgrade --install milvus deploy/milvus
else ifeq ($(TEST_TYPE), clickhouse)
$(HELM) upgrade --install clickhouse deploy/clickhouse
else ifeq ($(TEST_TYPE), zookeeper)
$(HELM) upgrade --install zookeeper deploy/zookeeper
else ifeq ($(TEST_TYPE), mariadb)
$(HELM) upgrade --install mariadb deploy/mariadb
else
$(error "test type does not exist")
endif
Expand Down
79 changes: 79 additions & 0 deletions test/e2e/testdata/smoketest/mariadb/00_mariadbcluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
# Source: mariadb/templates/rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: kb-mariadb-cluster
namespace: default
labels:
helm.sh/chart: mariadb-0.7.0-alpha.0
app.kubernetes.io/version: "10.6.15"
app.kubernetes.io/instance: mariadb-cluster
---
# Source: mariadb/templates/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kb-mariadb-cluster
labels:
helm.sh/chart: mariadb-0.7.0-alpha.0
app.kubernetes.io/version: "10.6.15"
app.kubernetes.io/instance: mariadb-cluster
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeblocks-volume-protection-pod-role
subjects:
- kind: ServiceAccount
name: kb-mariadb-cluster
namespace: default
---
# Source: mariadb/templates/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: kb-mariadb-cluster
labels:
helm.sh/chart: mariadb-0.7.0-alpha.0
app.kubernetes.io/version: "10.6.15"
app.kubernetes.io/instance: mariadb-cluster
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeblocks-cluster-pod-role
subjects:
- kind: ServiceAccount
name: kb-mariadb-cluster
namespace: default
---
# Source: mariadb/templates/cluster.yaml
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
name: mariadb-cluster
labels:
helm.sh/chart: mariadb-0.7.0-alpha.0
app.kubernetes.io/version: "10.6.15"
app.kubernetes.io/instance: mariadb-cluster
spec:
clusterVersionRef: mariadb
terminationPolicy: Delete
affinity:
podAntiAffinity: Required
topologyKeys:
- kubernetes.io/hostname
tenancy: SharedNode
clusterDefinitionRef: mariadb # ref clusterdefinition.name
componentSpecs:
- name: mariadb
componentDefRef: mariadb-compdef # ref clusterdefinition componentDefs.name
replicas: 1
serviceAccountName: kb-mariadb-cluster
resources:
limits:
cpu: "0.5"
memory: "0.5Gi"
requests:
cpu: "0.5"
memory: "0.5Gi"
services:
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/mariadb/01_vscale_out.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: mariadb-cluster-vscale-
spec:
clusterRef: mariadb-cluster
type: VerticalScaling
verticalScaling:
- componentName: mariadb
requests:
cpu: "1"
memory: "1Gi"
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/mariadb/02_vscale_in.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: mariadb-cluster-vscale-
spec:
clusterRef: mariadb-cluster
type: VerticalScaling
verticalScaling:
- componentName: mariadb
requests:
cpu: "0.5"
memory: "0.5Gi"
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/mariadb/03_stop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: mariadb-cluster-stop-
spec:
clusterRef: mariadb-cluster
ttlSecondsAfterSucceed: 27017
type: Stop
restart:
- componentName: mariadb
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/mariadb/04_start.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: mariadb-cluster-start-
spec:
clusterRef: mariadb-cluster
ttlSecondsAfterSucceed: 27017
type: Start
restart:
- componentName: mariadb
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/mariadb/05_restart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: mariadb-cluster-restart-
spec:
clusterRef: mariadb-cluster
ttlSecondsAfterSucceed: 27017
type: Restart
restart:
- componentName: mariadb
50 changes: 50 additions & 0 deletions test/e2e/testdata/smoketest/zookeeper/00_zookeepercluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
# Source: zookeeper-cluster/templates/cluster.yaml
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
name: zk-cluster
labels:

helm.sh/chart: zookeeper-cluster-0.7.0-alpha.0
app.kubernetes.io/version: "3.7.1"
app.kubernetes.io/instance: zk-cluster
spec:
clusterDefinitionRef: zookeeper
clusterVersionRef: zookeeper-3.7.1
terminationPolicy: Delete
affinity:
podAntiAffinity: Preferred
topologyKeys:
- kubernetes.io/hostname
tenancy: SharedNode
componentSpecs:
- name: zookeeper
componentDefRef: zookeeper
replicas: 3
serviceAccountName: kb-zk-cluster
monitor: false
resources:
limits:
cpu: "1"
memory: "2Gi"
requests:
cpu: "1"
memory: "2Gi"
volumeClaimTemplates:
- name: data # ref clusterdefinition components.containers.volumeMounts.name
spec:
storageClassName:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
- name: data-log # ref clusterdefinition components.containers.volumeMounts.name
spec:
storageClassName:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/zookeeper/01_vscale_out.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: zk-cluster-vscale-
spec:
clusterRef: zk-cluster
type: VerticalScaling
verticalScaling:
- componentName: zookeeper
requests:
cpu: "1.5"
memory: "2.5Gi"
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/zookeeper/02_vscale_in.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: zk-cluster-vscale-
spec:
clusterRef: zk-cluster
type: VerticalScaling
verticalScaling:
- componentName: zookeeper
requests:
cpu: "1"
memory: "2Gi"
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/zookeeper/03_hscale_out.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: zk-cluster-hscale-out-
spec:
clusterRef: zk-cluster
type: HorizontalScaling
horizontalScaling:
- componentName: zookeeper
replicas: 4
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/zookeeper/04_hscale_in.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: zk-cluster-hscale-in-
spec:
clusterRef: zk-cluster
type: HorizontalScaling
horizontalScaling:
- componentName: zookeeper
replicas: 2
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/zookeeper/05_vexpand.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: zk-cluster-vexpand-
spec:
clusterRef: zk-cluster
type: VolumeExpansion
volumeExpansion:
- componentName: zookeeper
volumeClaimTemplates:
- name: data
storage: "20Gi"
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/zookeeper/06_stop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: zk-cluster-stop-
spec:
clusterRef: zk-cluster
ttlSecondsAfterSucceed: 27017
type: Stop
restart:
- componentName: zookeeper
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/zookeeper/07_start.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: zk-cluster-start-
spec:
clusterRef: zk-cluster
ttlSecondsAfterSucceed: 27017
type: Start
restart:
- componentName: zookeeper
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/zookeeper/08_restart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: zk-cluster-restart-
spec:
clusterRef: zk-cluster
ttlSecondsAfterSucceed: 27017
type: Restart
restart:
- componentName: zookeeper

0 comments on commit a7cbf2d

Please sign in to comment.