Skip to content

Commit

Permalink
chore: add mysql-5.7 mysql-8.0 and PolarDB-X e2e test cases (#5370)
Browse files Browse the repository at this point in the history
  • Loading branch information
linghan-hub authored Oct 10, 2023
1 parent 385b383 commit 7143477
Show file tree
Hide file tree
Showing 43 changed files with 623 additions and 37 deletions.
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,17 @@ else ifeq ($(TEST_TYPE), weaviate)
$(HELM) dependency build deploy/weaviate-cluster --skip-refresh
$(HELM) upgrade --install weaviate deploy/weaviate
$(HELM) template weaviate-cluster deploy/weaviate-cluster > test/e2e/testdata/smoketest/weaviate/00_weaviatecluster.yaml
else ifeq ($(TEST_TYPE), mysql-80)
$(HELM) dependency build deploy/mysql-cluster --skip-refresh
$(HELM) upgrade --install mysql deploy/mysql
$(HELM) template mysqlcluster deploy/mysql-cluster > test/e2e/testdata/smoketest/mysql-80/00_mysqlcluster.yaml
else ifeq ($(TEST_TYPE), mysql-57)
$(HELM) dependency build deploy/mysql-cluster --skip-refresh
$(HELM) upgrade --install mysql deploy/mysql
else ifeq ($(TEST_TYPE), polardbx)
$(HELM) dependency build deploy/polardbx-cluster --skip-refresh
$(HELM) upgrade --install polardbx deploy/polardbx
$(HELM) template pxc deploy/polardbx-cluster > test/e2e/testdata/smoketest/polardbx/00_polardbxcluster.yaml
else
$(error "test type does not exist")
endif
Expand Down Expand Up @@ -714,6 +725,12 @@ else ifeq ($(TEST_TYPE), openldap)
$(HELM) upgrade --install openldap deploy/openldap
else ifeq ($(TEST_TYPE), weaviate)
$(HELM) upgrade --install weaviate deploy/weaviate
else ifeq ($(TEST_TYPE), mysql-80)
$(HELM) upgrade --install mysql deploy/mysql
else ifeq ($(TEST_TYPE), mysql-57)
$(HELM) upgrade --install mysql deploy/mysql
else ifeq ($(TEST_TYPE), polardbx)
$(HELM) upgrade --install polardbx deploy/polardbx
else
$(error "test type does not exist")
endif
Expand Down
16 changes: 8 additions & 8 deletions deploy/polardbx-cluster/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ spec:
clusterVersionRef: polardbx-{{ default .Chart.AppVersion .Values.clusterVersionOverride }}
terminationPolicy: {{ .Values.polardbx.terminationPolicy }}
componentSpecs:
- componentDefRef: gms
name: gms
- name: gms
componentDefRef: gms
replicas: {{ .Values.gms.replicas }}
{{- with .Values.gms.resources }}
resources:
Expand All @@ -37,8 +37,8 @@ spec:
{{- end }}
{{- $i := 0 }}
{{- range .Values.dn }}
- componentDefRef: dn
name: dn-{{ $i }}
- name: dn-{{ $i }}
componentDefRef: dn
replicas: {{ .replicas }}
{{- with .resources }}
resources:
Expand All @@ -65,8 +65,8 @@ spec:
{{- end }}
{{- end }}
{{- $i = add1 $i }}
- componentDefRef: cn
name: cn
- name: cn
componentDefRef: cn
replicas: {{ .Values.cn.replicas }}
{{- with .Values.cn.resources }}
resources:
Expand All @@ -81,8 +81,8 @@ spec:
memory: {{ .memory | quote }}
{{- end }}
{{- end }}
- componentDefRef: cdc
name: cdc
- name: cdc
componentDefRef: cdc
replicas: {{ .Values.cdc.replicas }}
{{- with .Values.cn.resources }}
resources:
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/testdata/smoketest/mongodb/01_vexpand.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ spec:
- componentName: mongodb
volumeClaimTemplates:
- name: data
storage: "20Gi"
storage: "21Gi"
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ spec:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
storage: 21Gi
80 changes: 80 additions & 0 deletions test/e2e/testdata/smoketest/mysql-57/00_mysqlcluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
# Source: mysql-cluster/templates/rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: kb-mysql-57-cluster
namespace: default
labels:
helm.sh/chart: mysql-cluster-0.7.0-alpha.0
app.kubernetes.io/version: "5.7.42"
app.kubernetes.io/instance: mysql-57-cluster
---
# Source: mysql-cluster/templates/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kb-mysql-57-cluster
labels:
helm.sh/chart: mysql-cluster-0.7.0-alpha.0
app.kubernetes.io/version: "5.7.42"
app.kubernetes.io/instance: mysql-57-cluster
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeblocks-volume-protection-pod-role
subjects:
- kind: ServiceAccount
name: kb-mysqlcluster
namespace: default
---
# Source: mysql-cluster/templates/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: kb-mysql-57-cluster
labels:
helm.sh/chart: mysql-cluster-0.7.0-alpha.0
app.kubernetes.io/version: "5.7.42"
app.kubernetes.io/instance: mysql-57-cluster
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeblocks-cluster-pod-role
subjects:
- kind: ServiceAccount
name: kb-mysqlcluster
namespace: default
---
# Source: mysql-cluster/templates/cluster.yaml
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
name: mysql-57-cluster
labels:
helm.sh/chart: mysql-cluster-0.7.0-alpha.0
app.kubernetes.io/version: "5.7.42"
app.kubernetes.io/instance: mysql-57-cluster
spec:
clusterVersionRef: mysql-5.7.42
terminationPolicy: Delete
affinity:
podAntiAffinity: Preferred
topologyKeys:
- kubernetes.io/hostname
tenancy: SharedNode
clusterDefinitionRef: mysql # ref clusterdefinition.name
componentSpecs:
- name: mysql
componentDefRef: mysql # ref clusterdefinition componentDefs.name
monitor: false
replicas: 1
serviceAccountName: kb-mysql-57-cluster
resources:
limits:
cpu: "1"
memory: "1Gi"
requests:
cpu: "1"
memory: "1Gi"
services:
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/mysql-57/01_vscale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: mysql-57-cluster-vscale-
spec:
clusterRef: mysql-57-cluster
type: VerticalScaling
verticalScaling:
- componentName: mysql
requests:
cpu: "1.5"
memory: 1.5Gi
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/mysql-57/02_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: mysql-57-cluster-hscale-out-
spec:
clusterRef: mysql-57-cluster
type: HorizontalScaling
horizontalScaling:
- componentName: mysql
replicas: 3
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/mysql-57/03_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: mysql-57-cluster-hscale-in-
spec:
clusterRef: mysql-57-cluster
type: HorizontalScaling
horizontalScaling:
- componentName: mysql
replicas: 1
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/mysql-57/04_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: mysql-57-cluster-stop-
spec:
clusterRef: mysql-57-cluster
ttlSecondsAfterSucceed: 27017
type: Stop
restart:
- componentName: mysql
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/mysql-57/05_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: mysql-57-cluster-start-
spec:
clusterRef: mysql-57-cluster
ttlSecondsAfterSucceed: 27017
type: Start
restart:
- componentName: mysql
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/mysql-57/06_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: mysql-57-cluster-restart-
spec:
clusterRef: mysql-57-cluster
ttlSecondsAfterSucceed: 27017
type: Restart
restart:
- componentName: mysql
80 changes: 80 additions & 0 deletions test/e2e/testdata/smoketest/mysql-80/00_mysqlcluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
# Source: mysql-cluster/templates/rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: kb-mysqlcluster
namespace: default
labels:
helm.sh/chart: mysql-cluster-0.7.0-alpha.0
app.kubernetes.io/version: "8.0.33"
app.kubernetes.io/instance: mysqlcluster
---
# Source: mysql-cluster/templates/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kb-mysqlcluster
labels:
helm.sh/chart: mysql-cluster-0.7.0-alpha.0
app.kubernetes.io/version: "8.0.33"
app.kubernetes.io/instance: mysqlcluster
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeblocks-volume-protection-pod-role
subjects:
- kind: ServiceAccount
name: kb-mysqlcluster
namespace: default
---
# Source: mysql-cluster/templates/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: kb-mysqlcluster
labels:
helm.sh/chart: mysql-cluster-0.7.0-alpha.0
app.kubernetes.io/version: "8.0.33"
app.kubernetes.io/instance: mysqlcluster
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeblocks-cluster-pod-role
subjects:
- kind: ServiceAccount
name: kb-mysqlcluster
namespace: default
---
# Source: mysql-cluster/templates/cluster.yaml
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
name: mysqlcluster
labels:
helm.sh/chart: mysql-cluster-0.7.0-alpha.0
app.kubernetes.io/version: "8.0.33"
app.kubernetes.io/instance: mysqlcluster
spec:
clusterVersionRef: mysql-8.0.33
terminationPolicy: Delete
affinity:
podAntiAffinity: Preferred
topologyKeys:
- kubernetes.io/hostname
tenancy: SharedNode
clusterDefinitionRef: mysql # ref clusterdefinition.name
componentSpecs:
- name: mysql
componentDefRef: mysql # ref clusterdefinition componentDefs.name
monitor: false
replicas: 1
serviceAccountName: kb-mysqlcluster
resources:
limits:
cpu: "1"
memory: "1Gi"
requests:
cpu: "1"
memory: "1Gi"
services:
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/mysql-80/01_vscale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: mysqlcluster-vscale-
spec:
clusterRef: mysqlcluster
type: VerticalScaling
verticalScaling:
- componentName: mysql
requests:
cpu: "1.5"
memory: 1.5Gi
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/mysql-80/02_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: cluster-hscale-out-
spec:
clusterRef: mysqlcluster
type: HorizontalScaling
horizontalScaling:
- componentName: mysql
replicas: 3
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/mysql-80/03_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: cluster-hscale-in-
spec:
clusterRef: mysqlcluster
type: HorizontalScaling
horizontalScaling:
- componentName: mysql
replicas: 1
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/mysql-80/04_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: cluster-stop-
spec:
clusterRef: mysqlcluster
ttlSecondsAfterSucceed: 27017
type: Stop
restart:
- componentName: mysql
10 changes: 10 additions & 0 deletions test/e2e/testdata/smoketest/mysql-80/05_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: cluster-start-
spec:
clusterRef: mysqlcluster
ttlSecondsAfterSucceed: 27017
type: Start
restart:
- componentName: mysql
Loading

0 comments on commit 7143477

Please sign in to comment.