Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
6d17a878
Commit
6d17a878
authored
Oct 07, 2016
by
Mike Danese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubectl: add two more test of kubectl apply --prune
parent
4a9f4028
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
test-cmd.sh
hack/make-rules/test-cmd.sh
+32
-0
No files found.
hack/make-rules/test-cmd.sh
View file @
6d17a878
...
@@ -1075,6 +1075,38 @@ __EOF__
...
@@ -1075,6 +1075,38 @@ __EOF__
# cleanup
# cleanup
kubectl delete pods b
kubectl delete pods b
# same thing without prune for a sanity check
# Pre-Condition: no POD exists
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# apply a
kubectl apply
-l
prune-group
=
true
-f
hack/testdata/prune/a.yaml
"
${
kube_flags
[@]
}
"
# check right pod exists
kube::test::get_object_assert
'pods a'
"{{
${
id_field
}
}}"
'a'
# check wrong pod doesn't exist
output_message
=
$(
!
kubectl get pods b 2>&1
"
${
kube_flags
[@]
}
"
)
kube::test::if_has_string
"
${
output_message
}
"
'pods "b" not found'
# apply b
kubectl apply
-l
prune-group
=
true
-f
hack/testdata/prune/b.yaml
"
${
kube_flags
[@]
}
"
# check both pods exist
kube::test::get_object_assert
'pods a'
"{{
${
id_field
}
}}"
'a'
kube::test::get_object_assert
'pods b'
"{{
${
id_field
}
}}"
'b'
# check wrong pod doesn't exist
# cleanup
kubectl delete pod/a pod/b
## kubectl apply --prune requires a --all flag to select everything
output_message
=
$(
!
kubectl apply
--prune
-f
hack/testdata/prune 2>&1
"
${
kube_flags
[@]
}
"
)
kube::test::if_has_string
"
${
output_message
}
"
\
'all resources selected for prune without explicitly passing --all'
# should apply everything
kubectl apply
--all
--prune
-f
hack/testdata/prune
kube::test::get_object_assert
'pods a'
"{{
${
id_field
}
}}"
'a'
kube::test::get_object_assert
'pods b'
"{{
${
id_field
}
}}"
'b'
kubectl delete pod/a pod/b
## kubectl run should create deployments or jobs
## kubectl run should create deployments or jobs
# Pre-Condition: no Job exists
# Pre-Condition: no Job exists
kube::test::get_object_assert
jobs
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert
jobs
"{{range.items}}{{
$id_field
}}:{{end}}"
''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment