Skip to content

Commit 25fb7ef

Browse files
committed
add curvine e2e test
Signed-off-by: xliuqq <xlzq1992@gmail.com>
1 parent df56d22 commit 25fb7ef

7 files changed

Lines changed: 179 additions & 5 deletions

File tree

.github/scripts/build-all-images.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function build_images() {
2020
${IMG_REPO}/thinruntime-controller:${IMAGE_TAG}
2121
${IMG_REPO}/efcruntime-controller:${IMAGE_TAG}
2222
${IMG_REPO}/vineyardruntime-controller:${IMAGE_TAG}
23+
${IMG_REPO}/cacheruntime-controller:${IMAGE_TAG}
2324
${IMG_REPO}/fluid-csi:${IMAGE_TAG}
2425
${IMG_REPO}/fluid-webhook:${IMAGE_TAG}
2526
${IMG_REPO}/fluid-crd-upgrader:${IMAGE_TAG}

.github/scripts/gha-e2e.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ function juicefs_e2e() {
100100
bash test/gha-e2e/juicefs/test.sh
101101
}
102102

103+
function curvine_e2e() {
104+
set -e
105+
bash test/gha-e2e/curvine/test.sh
106+
}
107+
103108
check_control_plane_status
104109
alluxio_e2e
105110
jindo_e2e
106111
juicefs_e2e
112+
curvine_e2e

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ DOCKER_PUSH += docker-push-webhook
125125
DOCKER_PUSH += docker-push-goosefsruntime-controller
126126
DOCKER_PUSH += docker-push-juicefsruntime-controller
127127
DOCKER_PUSH += docker-push-thinruntime-controller
128-
#DOCKER_PUSH += docker-push-cacheruntime-controller
128+
DOCKER_PUSH += docker-push-cacheruntime-controller
129129
DOCKER_PUSH += docker-push-efcruntime-controller
130130
DOCKER_PUSH += docker-push-vineyardruntime-controller
131131
# Not need to push init-users image by default
@@ -143,7 +143,7 @@ DOCKER_BUILDX_PUSH += docker-buildx-push-csi
143143
DOCKER_BUILDX_PUSH += docker-buildx-push-webhook
144144
DOCKER_BUILDX_PUSH += docker-buildx-push-juicefsruntime-controller
145145
DOCKER_BUILDX_PUSH += docker-buildx-push-thinruntime-controller
146-
#DOCKER_BUILDX_PUSH += docker-buildx-push-cacheruntime-controller
146+
DOCKER_BUILDX_PUSH += docker-buildx-push-cacheruntime-controller
147147
DOCKER_BUILDX_PUSH += docker-buildx-push-efcruntime-controller
148148
DOCKER_BUILDX_PUSH += docker-buildx-push-vineyardruntime-controller
149149
# Not need to push init-users image by default

test/gha-e2e/curvine/read_job.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ spec:
2323
command: ['sh']
2424
args:
2525
- -c
26-
- set -ex; test -n "$(cat /data/foo/bar)"
26+
- set -ex; test -n "$(cat /data/minio/bar)"
2727
volumeMounts:
2828
- name: data-vol
2929
mountPath: /data

test/gha-e2e/curvine/test.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ function setup() {
2828
}
2929

3030
function create_dataset() {
31+
kubectl create -f test/gha-e2e/curvine/cacheruntimeclass.yaml
3132
kubectl create -f test/gha-e2e/curvine/dataset.yaml
3233
kubectl create -f test/gha-e2e/curvine/cacheruntime.yaml
33-
kubectl create -f test/gha-e2e/curvine/cacheruntimeclass.yaml
3434

3535
if [[ -z "$(kubectl get dataset $dataset_name -oname)" ]]; then
3636
panic "failed to create dataset $dataset_name"
@@ -39,6 +39,11 @@ function create_dataset() {
3939
if [[ -z "$(kubectl get cacheruntime $dataset_name -oname)" ]]; then
4040
panic "failed to create curvine cache runtime $dataset_name"
4141
fi
42+
43+
if [[ -z "$(kubectl get cacheruntimeclass $dataset_name -oname)" ]]; then
44+
panic "failed to create curvine cache runtime class $dataset_name"
45+
fi
46+
4247
}
4348

4449
function wait_dataset_bound() {

test/gha-e2e/curvine/write_job.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ spec:
2020
limits:
2121
ephemeral-storage: "5Gi"
2222
memory: "512Mi"
23-
command: ['sh', '-c', 'mkdir /data/foo && echo helloworld > /data/foo/bar']
23+
command: ['sh', '-c', 'echo helloworld > /data/minio/bar']
2424
volumeMounts:
2525
- name: data-vol
2626
mountPath: /data

tools/diagnose-fluid-curvine.sh

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
#!/usr/bin/env bash
2+
set +x
3+
4+
print_usage() {
5+
echo "Usage:"
6+
echo " ./diagnose-fluid-curvine.sh COMMAND [OPTIONS]"
7+
echo "COMMAND:"
8+
echo " help"
9+
echo " Display this help message."
10+
echo " collect"
11+
echo " Collect pods logs of controller and runtime."
12+
echo "OPTIONS:"
13+
echo " -r, --name name"
14+
echo " Set the name of runtime."
15+
echo " -n, --namespace name"
16+
echo " Set the namespace of runtime."
17+
echo " --collect-path"
18+
echo " Set which file the information is collected into. (default: $(pwd)/diagnose_fluid_\${timestamp}.tar.gz)"
19+
}
20+
21+
run() {
22+
echo
23+
echo "-----------------run $*------------------"
24+
timeout 10s "$@"
25+
if [ $? != 0 ]; then
26+
echo "failed to collect info: $*"
27+
fi
28+
echo "------------End of ${1}----------------"
29+
}
30+
31+
pod_status() {
32+
local namespace=${1:-"default"}
33+
run kubectl get pods -owide -n ${namespace} &>"$diagnose_dir/pods-${namespace}.log"
34+
run kubectl get pods -oyaml -n ${namespace} &>>"$diagnose_dir/pods-${namespace}.log"
35+
}
36+
37+
fluid_pod_logs() {
38+
core_component "${fluid_namespace}" "manager" "control-plane=cacheruntime-controller"
39+
core_component "${fluid_namespace}" "manager" "control-plane=dataset-controller"
40+
core_component "${fluid_namespace}" "plugins" "app=csi-nodeplugin-fluid"
41+
core_component "${fluid_namespace}" "node-driver-registrar" "app=csi-nodeplugin-fluid"
42+
}
43+
44+
runtime_pod_logs() {
45+
core_component "${runtime_namespace}" "master" "cacheruntime.fluid.io/component-name=${runtime_name}-master"
46+
core_component "${runtime_namespace}" "worker" "cacheruntime.fluid.io/component-name=${runtime_name}-worker"
47+
core_component "${runtime_namespace}" "client" "cacheruntime.fluid.io/component-name=${runtime_name}-client"
48+
}
49+
50+
core_component() {
51+
# namespace container selectors...
52+
local namespace="$1"
53+
local container="$2"
54+
shift 2
55+
local selectors="$*"
56+
local constrains
57+
local pods
58+
constrains=$(echo "${selectors}" | tr ' ' ',')
59+
if [[ -n ${constrains} ]]; then
60+
constrains="-l ${constrains}"
61+
fi
62+
mkdir -p "$diagnose_dir/pods-${namespace}"
63+
pods=$(kubectl get po -n ${namespace} "${constrains}" | awk '{print $1}' | grep -v NAME)
64+
for po in ${pods}; do
65+
kubectl logs "${po}" -c "$container" -n ${namespace} &>"$diagnose_dir/pods-${namespace}/${po}-${container}.log" 2>&1
66+
done
67+
}
68+
69+
kubectl_resource() {
70+
# runtime, dataset, pv and pvc should have the same name
71+
kubectl describe dataset --namespace ${runtime_namespace} ${runtime_name} &>"${diagnose_dir}/dataset-${runtime_name}.yaml" 2>&1
72+
kubectl describe cacheruntime --namespace ${runtime_namespace} ${name} &>"${diagnose_dir}/cacheruntime-${runtime_name}.yaml" 2>&1
73+
kubectl describe pv ${runtime_namespace}-${runtime_name} &>"${diagnose_dir}/pv-${runtime_name}.yaml" 2>&1
74+
kubectl describe pvc ${runtime_name} --namespace ${runtime_namespace} &>"${diagnose_dir}/pvc-${runtime_name}.yaml" 2>&1
75+
}
76+
77+
archive() {
78+
tar_filename="${current_dir}/diagnose_fluid_${timestamp}.tar.gz"
79+
if [[ ! -z "${collect_path}" ]]; then
80+
tar_filename=${collect_path}
81+
mkdir -p $(dirname "$tar_filename")
82+
fi
83+
tar -zcvf "${tar_filename}" "${diagnose_dir}"
84+
echo "please get ${tar_filename} for diagnostics"
85+
}
86+
87+
pd_collect() {
88+
echo "Start collecting, runtime-name=${runtime_name}, runtime-namespace=${runtime_namespace}"
89+
90+
pod_status "${fluid_namespace}"
91+
pod_status "${runtime_namespace}"
92+
runtime_pod_logs
93+
fluid_pod_logs
94+
kubectl_resource
95+
archive
96+
}
97+
98+
collect()
99+
{
100+
# ensure params
101+
fluid_name=${fluid_name:-"fluid"}
102+
fluid_namespace=${fluid_namespace:-"fluid-system"}
103+
runtime_name=${runtime_name:?"the name of runtime must be set"}
104+
runtime_namespace=${runtime_namespace:-"default"}
105+
106+
current_dir=$(pwd)
107+
timestamp=$(date +%s)
108+
diagnose_dir="/tmp/diagnose_fluid_${timestamp}"
109+
mkdir -p "$diagnose_dir"
110+
111+
pd_collect
112+
}
113+
114+
main() {
115+
if [[ $# -eq 0 ]]; then
116+
print_usage
117+
exit 1
118+
fi
119+
120+
action="help"
121+
122+
while [[ $# -gt 0 ]]; do
123+
case $1 in
124+
-h|--help|"-?")
125+
print_usage
126+
exit 0;
127+
;;
128+
collect|help)
129+
action=$1
130+
;;
131+
-r|--name)
132+
runtime_name=$2
133+
shift
134+
;;
135+
-n|--namespace)
136+
runtime_namespace=$2
137+
shift
138+
;;
139+
--collect-path)
140+
collect_path=$2
141+
shift
142+
;;
143+
*)
144+
echo "Error: unsupported option $1" >&2
145+
print_usage
146+
exit 1
147+
;;
148+
esac
149+
shift
150+
done
151+
152+
case ${action} in
153+
collect)
154+
collect
155+
;;
156+
help)
157+
print_usage
158+
;;
159+
esac
160+
}
161+
162+
main "$@"

0 commit comments

Comments
 (0)