Skip to content

Commit

Permalink
Add the schedule workload e2e test.
Browse files Browse the repository at this point in the history
Signed-off-by: Ye Cao <[email protected]>
  • Loading branch information
dashanji committed Aug 1, 2023
1 parent 785f8db commit ab307b1
Show file tree
Hide file tree
Showing 7 changed files with 188 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/workflows/vineyard-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
- e2e-tests-failover
- e2e-tests-repartition-dask
- e2e-tests-scheduler-outside-cluster
- e2e-tests-schedule-workload-logs
- e2e-tests-serialize
- e2e-tests-sidecar
- e2e-tests-spill
Expand Down Expand Up @@ -167,6 +168,7 @@ jobs:
e2e-tests-failover \
e2e-tests-repartition-dask \
e2e-tests-scheduler-outside-cluster \
e2e-tests-schedule-workload \
e2e-tests-serialize \
e2e-tests-sidecar \
e2e-tests-spill \
Expand Down Expand Up @@ -217,6 +219,11 @@ jobs:
run: |
make -C k8s/test/e2e e2e-tests-scheduler-outside-cluster
- name: e2e-tests-schedule-workload
if: ${{ matrix.job == 'e2e-tests-schedule-workload' }}
run: |
make -C k8s/test/e2e e2e-tests-schedule-workload
- name: e2e-tests-serialize
if: ${{ matrix.job == 'e2e-tests-serialize' }}
run: |
Expand Down
5 changes: 5 additions & 0 deletions .stoat/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,8 @@ plugins:
name: "deploy-raw-backup-and-recover-logs"
path: e2e-tests-deploy-raw-backup-and-recover-logs
file_viewer: true
e2e-tests-schedule-workload-logs:
metadata:
name: "schedule-workload-logs"
path: e2e-tests-schedule-workload-logs
file_viewer: true
11 changes: 10 additions & 1 deletion k8s/test/e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ e2e-tests-vineyardctl: prepare-e2e-test build-local-cluster load-vineyardd-image
@make delete-local-cluster
.PHONY: e2e-tests-vineyardctl

############# vineyardctl testing ################################################
############# backup and recover testing ################################################

e2e-tests-deploy-raw-backup-and-recover: prepare-e2e-test build-local-cluster load-vineyardd-image
@echo "Running vineyardctl backup and recover e2e test..."
Expand All @@ -367,6 +367,15 @@ e2e-tests-deploy-raw-backup-and-recover: prepare-e2e-test build-local-cluster lo
@make delete-local-cluster
.PHONY: e2e-tests-deploy-raw-backup-and-recover

############# schedule workload testing ################################################

e2e-tests-schedule-workload: prepare-e2e-test build-local-cluster load-vineyardd-image
@echo "Running schedule workload e2e test..."
@cd ${ROOT_DIR} && ${GOBIN}/e2e run --config=${E2E_DIR}/schedule-workload/e2e.yaml
@echo "schedule workload e2e test passed."
@make delete-local-cluster
.PHONY: e2e-tests-schedule-workload

# publish all images to ghcr registry
ALL-IMAGES ?= \
publish-local-assembly-images \
Expand Down
47 changes: 47 additions & 0 deletions k8s/test/e2e/schedule-workload-demo/consumer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2020-2023 Alibaba Group Holding Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

apiVersion: apps/v1
kind: Deployment
metadata:
name: consumer
namespace: vineyard-job
spec:
selector:
matchLabels:
app: consumer
replicas: 1
template:
metadata:
labels:
app: consumer
spec:
containers:
- name: consumer
image: python:3.10
command:
- bash
- -c
- |
pip install vineyard numpy pandas;
cat << EOF >> consumer.py
import vineyard
client = vineyard.connect()
unit_obj = client.get_name("test_basic_data_unit")
print(client.get(unit_obj,fetch=True))
client.close()
EOF
python consumer.py;
sleep infinity;
48 changes: 48 additions & 0 deletions k8s/test/e2e/schedule-workload-demo/producer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2020-2023 Alibaba Group Holding Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

apiVersion: apps/v1
kind: Deployment
metadata:
name: producer
namespace: vineyard-job
spec:
selector:
matchLabels:
app: producer
replicas: 1
template:
metadata:
labels:
app: producer
spec:
containers:
- name: producer
image: python:3.10
command:
- bash
- -c
- |
pip install vineyard numpy pandas;
cat << EOF >> producer.py
import vineyard
import numpy as np
import pandas as pd
client = vineyard.connect()
client.put((1, 1.2345, 'xxxxabcd'), persist=True, name="test_basic_data_unit");
client.close()
EOF
python producer.py;
sleep infinity;
55 changes: 55 additions & 0 deletions k8s/test/e2e/schedule-workload/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2020-2023 Alibaba Group Holding Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

setup:
env: kind
kubeconfig: /tmp/e2e-k8s.config
steps:
- name: deploy the vineyard deployment
command: |
go run k8s/cmd/main.go deploy vineyard-deployment --vineyardd.image="localhost:5001/vineyardd:alpine-latest" --create-namespace
- name: schedule the produce workload
command: |
kubectl create ns vineyard-job
go run k8s/cmd/main.go schedule workload -f k8s/test/e2e/schedule-workload-demo/producer.yaml | kubectl apply -f -
wait:
- namespace: vineyard-job
resource: deployment/producer
for: condition=Available
- name: schedule the consume workload
command: |
go run k8s/cmd/main.go schedule workload -f k8s/test/e2e/schedule-workload-demo/consumer.yaml | kubectl apply -f -
wait:
- namespace: vineyard-job
resource: deployment/consumer
for: condition=Available
timeout: 20m

cleanup:
# always never success failure
on: success

verify:
# verify with retry strategy
retry:
# max retry count
count: 10
# the interval between two attempts, e.g. 10s, 1m.
interval: 10s
cases:
- query: |
kubectl logs --tail 1 $(kubectl get pod -lapp=consumer -n vineyard-job -o jsonpath='{.items[0].metadata.name}') \
-n vineyard-job
expected: ../verify/basic-types-unit.yaml
16 changes: 16 additions & 0 deletions k8s/test/e2e/verify/basic-types-unit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2020-2023 Alibaba Group Holding Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

(1, 1.2345000505447388, 'xxxxabcd')

0 comments on commit ab307b1

Please sign in to comment.