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
62960aac
Commit
62960aac
authored
Oct 06, 2016
by
Mike Danese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a test for kubectl apply --prune
parent
ea5ecc41
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
1 deletion
+44
-1
test-cmd.sh
hack/make-rules/test-cmd.sh
+24
-1
a.yaml
hack/testdata/prune/a.yaml
+10
-0
b.yaml
hack/testdata/prune/b.yaml
+10
-0
No files found.
hack/make-rules/test-cmd.sh
View file @
62960aac
...
@@ -1052,6 +1052,29 @@ __EOF__
...
@@ -1052,6 +1052,29 @@ __EOF__
kubectl delete pods selector-test-pod
kubectl delete pods selector-test-pod
## kubectl apply --prune
# Pre-Condition: no POD exists
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# apply a
kubectl apply
--prune
-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
--prune
-l
prune-group
=
true
-f
hack/testdata/prune/b.yaml
"
${
kube_flags
[@]
}
"
# check right pod exists
kube::test::get_object_assert
'pods b'
"{{
${
id_field
}
}}"
'b'
# check wrong pod doesn't exist
output_message
=
$(
!
kubectl get pods a 2>&1
"
${
kube_flags
[@]
}
"
)
kube::test::if_has_string
"
${
output_message
}
"
'pods "a" not found'
# cleanup
kubectl delete pods 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}}"
''
...
@@ -1161,7 +1184,7 @@ __EOF__
...
@@ -1161,7 +1184,7 @@ __EOF__
]
]
}
}
__EOF__
__EOF__
# Post-Condition: assertion object exist
# Post-Condition: assertion object exist
kube::test::get_object_assert thirdpartyresources
"{{range.items}}{{
$id_field
}}:{{end}}"
'bar.company.com:foo.company.com:'
kube::test::get_object_assert thirdpartyresources
"{{range.items}}{{
$id_field
}}:{{end}}"
'bar.company.com:foo.company.com:'
...
...
hack/testdata/prune/a.yaml
0 → 100644
View file @
62960aac
apiVersion
:
v1
kind
:
Pod
metadata
:
name
:
a
labels
:
prune-group
:
"
true"
spec
:
containers
:
-
name
:
kubernetes-pause
image
:
gcr.io/google-containers/pause:2.0
hack/testdata/prune/b.yaml
0 → 100644
View file @
62960aac
apiVersion
:
v1
kind
:
Pod
metadata
:
name
:
b
labels
:
prune-group
:
"
true"
spec
:
containers
:
-
name
:
kubernetes-pause
image
:
gcr.io/google-containers/pause:2.0
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