From 92692c92e702c4e6b42ad4d2459cffc6ac73f98a Mon Sep 17 00:00:00 2001 From: Jun Duan Date: Thu, 7 Mar 2024 21:36:05 +0000 Subject: [PATCH] Test the deletion of workstatus Signed-off-by: Jun Duan --- test/e2e/run.sh | 1 + test/e2e/workstatus-deletion.sh | 40 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100755 test/e2e/workstatus-deletion.sh diff --git a/test/e2e/run.sh b/test/e2e/run.sh index 31c8b82..fde1e77 100755 --- a/test/e2e/run.sh +++ b/test/e2e/run.sh @@ -24,3 +24,4 @@ ${SRC_DIR}/setup-ocm.sh ${SRC_DIR}/workstatus-creation.sh ${SRC_DIR}/workstatus-patching.sh ${SRC_DIR}/workstatus-updating.sh +${SRC_DIR}/workstatus-deletion.sh diff --git a/test/e2e/workstatus-deletion.sh b/test/e2e/workstatus-deletion.sh new file mode 100755 index 0000000..421f692 --- /dev/null +++ b/test/e2e/workstatus-deletion.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# Copyright 2024 The KubeStellar Authors. +# +# 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. + +set -x # echo so that users can understand what is happening +set -e # exit on error + +: +: ------------------------------------------------------------------------- +: Verify that the WorkStatus exists in the hub +: +wait-for-cmd '[ "$(kubectl --context kind-hub -n cluster1 get workstatus appsv1-deployment-nginx-nginx -o name --no-headers 2>/dev/null | wc -l)" == 1 ]' + +: +: ------------------------------------------------------------------------- +: Delete the ManifestWork object in hub +: +kubectl --context kind-hub -n cluster1 delete manifestwork nginx-deployment + +: +: ------------------------------------------------------------------------- +: Verify that the WorkStatus has been deleted in the hub +: +wait-for-cmd '[ "$(kubectl --context kind-hub -n cluster1 get workstatus appsv1-deployment-nginx-nginx -o name --no-headers 2>/dev/null | wc -l)" == 0 ]' + +: +: ------------------------------------------------------------------------- +: SUCCESS: Workstatus deletion test passed +: