Skip to content

Commit

Permalink
chore: add e2e test cases (#5399)
Browse files Browse the repository at this point in the history
  • Loading branch information
linghan-hub authored Oct 11, 2023
1 parent c72e3cd commit 4ad41db
Show file tree
Hide file tree
Showing 48 changed files with 901 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,30 @@ 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 ifeq ($(TEST_TYPE), opensearch)
$(HELM) dependency build deploy/opensearch-cluster --skip-refresh
$(HELM) upgrade --install opensearch deploy/opensearch
$(HELM) template opensearch-cluster deploy/opensearch-cluster > test/e2e/testdata/smoketest/opensearch/00_opensearchcluster.yaml
else ifeq ($(TEST_TYPE), elasticsearch)
$(HELM) dependency build deploy/elasticsearch-cluster --skip-refresh
$(HELM) upgrade --install elasticsearch deploy/elasticsearch
$(HELM) template elasticsearch-cluster deploy/elasticsearch-cluster > test/e2e/testdata/smoketest/elasticsearch/00_elasticsearchcluster.yaml
else ifeq ($(TEST_TYPE), llm)
$(HELM) dependency build deploy/llm-cluster --skip-refresh
$(HELM) upgrade --install llm deploy/llm
$(HELM) template llm-cluster deploy/llm-cluster > test/e2e/testdata/smoketest/llm/00_llmcluster.yaml
else ifeq ($(TEST_TYPE), tdengine)
$(HELM) dependency build deploy/tdengine-cluster --skip-refresh
$(HELM) upgrade --install tdengine deploy/tdengine
$(HELM) template td-cluster deploy/tdengine-cluster > test/e2e/testdata/smoketest/tdengine/00_tdenginecluster.yaml
else ifeq ($(TEST_TYPE), milvus)
$(HELM) dependency build deploy/milvus-cluster --skip-refresh
$(HELM) upgrade --install milvus deploy/milvus
$(HELM) template milvus-cluster deploy/milvus-cluster > test/e2e/testdata/smoketest/milvus/00_milvuscluster.yaml
else ifeq ($(TEST_TYPE), clickhouse)
$(HELM) dependency build deploy/clickhouse-cluster --skip-refresh
$(HELM) upgrade --install clickhouse deploy/clickhouse
$(HELM) template c-cluster deploy/clickhouse-cluster > test/e2e/testdata/smoketest/clickhouse/00_clickhousecluster.yaml
else
$(error "test type does not exist")
endif
Expand Down Expand Up @@ -731,6 +755,16 @@ else ifeq ($(TEST_TYPE), mysql-57)
$(HELM) upgrade --install mysql deploy/mysql
else ifeq ($(TEST_TYPE), polardbx)
$(HELM) upgrade --install polardbx deploy/polardbx
else ifeq ($(TEST_TYPE), opensearch)
$(HELM) upgrade --install opensearch deploy/opensearch
else ifeq ($(TEST_TYPE), elasticsearch)
$(HELM) upgrade --install elasticsearch deploy/elasticsearch
else ifeq ($(TEST_TYPE), llm)
$(HELM) upgrade --install llm deploy/llm
else ifeq ($(TEST_TYPE), milvus)
$(HELM) upgrade --install milvus deploy/milvus
else ifeq ($(TEST_TYPE), clickhouse)
$(HELM) upgrade --install milvus deploy/clickhouse
else
$(error "test type does not exist")
endif
Expand Down
94 changes: 94 additions & 0 deletions test/e2e/testdata/smoketest/clickhouse/00_clickhousecluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
# Source: clickhouse-cluster/templates/rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: kb-c-cluster
namespace: default
labels:
helm.sh/chart: clickhouse-cluster-0.7.0-alpha.0
app.kubernetes.io/version: "22.9.4"
app.kubernetes.io/instance: c-cluster
---
# Source: clickhouse-cluster/templates/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kb-c-cluster
labels:
helm.sh/chart: clickhouse-cluster-0.7.0-alpha.0
app.kubernetes.io/version: "22.9.4"
app.kubernetes.io/instance: c-cluster
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeblocks-volume-protection-pod-role
subjects:
- kind: ServiceAccount
name: kb-c-cluster
namespace: default
---
# Source: clickhouse-cluster/templates/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: kb-c-cluster
labels:
helm.sh/chart: clickhouse-cluster-0.7.0-alpha.0
app.kubernetes.io/version: "22.9.4"
app.kubernetes.io/instance: c-cluster
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeblocks-cluster-pod-role
subjects:
- kind: ServiceAccount
name: kb-c-cluster
namespace: default
---
# Source: clickhouse-cluster/templates/cluster.yaml
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
name: c-cluster-clickhouse-cluster
labels:
helm.sh/chart: clickhouse-cluster-0.7.0-alpha.0
app.kubernetes.io/name: clickhouse-cluster
app.kubernetes.io/instance: c-cluster
app.kubernetes.io/version: "22.9.4"
app.kubernetes.io/managed-by: Helm
spec:
clusterDefinitionRef: clickhouse # ref clusterdefinition.name
clusterVersionRef: clickhouse-22.9.4 # ref clusterversion.name
terminationPolicy: Halt
affinity:
topologyKeys:
- kubernetes.io/hostname
componentSpecs:
- name: shard-0
componentDefRef: clickhouse
monitor: false
serviceType: ClusterIP
replicas: 2
serviceAccountName: kb-c-cluster-clickhouse-cluster
---
# Source: clickhouse-cluster/templates/tests/test-connection.yaml
apiVersion: v1
kind: Pod
metadata:
name: "c-cluster-clickhouse-cluster-test-connection"
labels:
helm.sh/chart: clickhouse-cluster-0.7.0-alpha.0
app.kubernetes.io/name: clickhouse-cluster
app.kubernetes.io/instance: c-cluster
app.kubernetes.io/version: "22.9.4"
app.kubernetes.io/managed-by: Helm
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['c-cluster-clickhouse-cluster:']
restartPolicy: Never
57 changes: 57 additions & 0 deletions test/e2e/testdata/smoketest/clickhouse/00_milvuscluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
# Source: milvus-cluster/templates/cluster.yaml
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
name: milvus-cluster
labels:
helm.sh/chart: milvus-cluster-0.7.0-alpha.0
app.kubernetes.io/name: milvus-cluster
app.kubernetes.io/instance: milvus-cluster
app.kubernetes.io/version: "2.2.4"
app.kubernetes.io/managed-by: Helm
spec:
clusterDefinitionRef: milvus # ref clusterdefinition.name
clusterVersionRef: milvus-2.2.4 # ref clusterversion.name
terminationPolicy: Delete
affinity:
componentSpecs:
- name: milvus # user-defined
componentDefRef: milvus # ref clusterdefinition components.name
monitor: false
replicas: 1
volumeClaimTemplates:
- name: data # ref clusterdefinition components.containers.volumeMounts.name
spec:
storageClassName:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
- name: etcd # user-defined
componentDefRef: etcd # ref clusterdefinition components.name
monitor: false
replicas: 1
volumeClaimTemplates:
- name: data # ref clusterdefinition components.containers.volumeMounts.name
spec:
storageClassName:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
- name: minio # user-defined
componentDefRef: minio # ref clusterdefinition components.name
monitor: false
replicas: 1
volumeClaimTemplates:
- name: data # ref clusterdefinition components.containers.volumeMounts.name
spec:
storageClassName:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/clickhouse/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: milvus-cluster-vscale-
spec:
clusterRef: milvus-cluster
type: VerticalScaling
verticalScaling:
- componentName: milvus
requests:
cpu: "500m"
memory: 500Mi
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/clickhouse/02_hscale_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: milvus-cluster-hscale-out-
spec:
clusterRef: milvus-cluster
type: HorizontalScaling
horizontalScaling:
- componentName: milvus
replicas: 2
- componentName: minio
replicas: 2
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/clickhouse/03_hscale_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: milvus-cluster-hscale-in-
spec:
clusterRef: milvus-cluster
type: HorizontalScaling
horizontalScaling:
- componentName: milvus
replicas: 1
- componentName: minio
replicas: 1
20 changes: 20 additions & 0 deletions test/e2e/testdata/smoketest/clickhouse/04_vexpand.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: milvus-cluster-vexpand-
spec:
clusterRef: milvus-cluster
type: VolumeExpansion
volumeExpansion:
- componentName: milvus
volumeClaimTemplates:
- name: data
storage: "15Gi"
- componentName: etcd
volumeClaimTemplates:
- name: data
storage: "15Gi"
- componentName: minio
volumeClaimTemplates:
- name: data
storage: "15Gi"
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/clickhouse/05_stop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: milvus-cluster-stop-
spec:
clusterRef: milvus-cluster
ttlSecondsAfterSucceed: 27017
type: Stop
restart:
- componentName: milvus
- componentName: etcd
- componentName: minio
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/clickhouse/06_start.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: milvus-cluster-start-
spec:
clusterRef: milvus-cluster
ttlSecondsAfterSucceed: 27017
type: Start
restart:
- componentName: milvus
- componentName: etcd
- componentName: minio
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/clickhouse/07_restart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
generateName: milvus-cluster-restart-
spec:
clusterRef: milvus-cluster
ttlSecondsAfterSucceed: 27017
type: Restart
restart:
- componentName: milvus
- componentName: etcd
- componentName: minio
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
# Source: elasticsearch-cluster/templates/cluster.yaml
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
name: elasticsearch-cluster
labels:
helm.sh/chart: elasticsearch-cluster-0.1.0
app.kubernetes.io/name: elasticsearch-cluster
app.kubernetes.io/instance: elasticsearch-cluster
app.kubernetes.io/version: "8.8.0"
app.kubernetes.io/managed-by: Helm
spec:
clusterDefinitionRef: elasticsearch # ref clusterdefinition.name
clusterVersionRef: elasticsearch-8.8.0 # ref clusterversion.name
terminationPolicy: Delete
affinity:
topologyKeys:
- kubernetes.io/hostname
componentSpecs:
- name: elasticsearch # user-defined
componentDefRef: elasticsearch # ref clusterdefinition componentDefs.name
monitor: false
replicas: 1
volumeClaimTemplates:
- name: data # ref clusterdefinition components.containers.volumeMounts.name
spec:
storageClassName:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi

- name: metrics # user-defined
componentDefRef: metrics # ref clusterdefinition componentDefs.name
replicas: 1
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/elasticsearch/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: elasticsearch-cluster-vscale-
spec:
clusterRef: elasticsearch-cluster
type: VerticalScaling
verticalScaling:
- componentName: elasticsearch
requests:
cpu: "500m"
memory: 500Mi
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/elasticsearch/02_hscale_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: elasticsearch-cluster-hscale-out-
spec:
clusterRef: elasticsearch-cluster
type: HorizontalScaling
horizontalScaling:
- componentName: elasticsearch
replicas: 3
- componentName: metrics
replicas: 2
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/elasticsearch/03_hscale_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: elasticsearch-cluster-hscale-in-
spec:
clusterRef: elasticsearch-cluster
type: HorizontalScaling
horizontalScaling:
- componentName: elasticsearch
replicas: 1
- componentName: metrics
replicas: 1
12 changes: 12 additions & 0 deletions test/e2e/testdata/smoketest/elasticsearch/04_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: elasticsearch-cluster-vexpand-
spec:
clusterRef: elasticsearch-cluster
type: VolumeExpansion
volumeExpansion:
- componentName: elasticsearch
volumeClaimTemplates:
- name: data
storage: "10Gi"
Loading

0 comments on commit 4ad41db

Please sign in to comment.