Skip to content

Commit 751d01c

Browse files
committed
add cmd test
1 parent ee2e382 commit 751d01c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/cmd/annotations.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
3+
trap os::test::junit::reconcile_output EXIT
4+
5+
# Cleanup cluster resources created by this test
6+
(
7+
set +e
8+
oc delete all,templates --all
9+
exit 0
10+
) &>/dev/null
11+
12+
13+
os::test::junit::declare_suite_start "cmd/annotate"
14+
# This test validates empty values in key-value pairs set by the annotate command
15+
os::cmd::expect_success_and_text 'oc process -f examples/zookeeper/template.json | oc apply -f -' 'pod "zookeeper-1" created'
16+
os::cmd::expect_success_and_text 'oc annotate pod zookeeper-1 node-selector=""' 'pod "zookeeper-1" annotated'
17+
os::cmd::expect_success_and_text 'oc get pod zookeeper-1 --template="{{.metadata.annotations}}"' 'node-selector: '
18+
19+
echo "annotate: ok"
20+
os::test::junit::declare_suite_end
21+
22+
os::test::junit::declare_suite_start "cmd/label"
23+
# This test validates empty values in key-value pairs set by the label command
24+
os::cmd::expect_success_and_text 'oc label pod zookeeper-1 label2=""' 'pod "zookeeper-1" labeled'
25+
os::cmd::expect_success_and_text 'oc get pod zookeeper-1 --template="{{.metadata.labels}}"' 'label2\: name\:zookeeper server-id\:1 template\:zookeeper'
26+
27+
echo "label: ok"
28+
os::test::junit::declare_suite_end

0 commit comments

Comments
 (0)