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
6339d915
Commit
6339d915
authored
Sep 29, 2016
by
Mike Danese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a test to test-cmd.sh for apply -f with label selector
parent
5f2569c1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
test-cmd.sh
hack/make-rules/test-cmd.sh
+15
-0
pod-apply-selector.yaml
hack/testdata/filter/pod-apply-selector.yaml
+11
-0
pod-dont-apply.yaml
hack/testdata/filter/pod-dont-apply.yaml
+11
-0
No files found.
hack/make-rules/test-cmd.sh
View file @
6339d915
...
...
@@ -988,6 +988,21 @@ __EOF__
# Clean up
kubectl delete pods test-pod
"
${
kube_flags
[@]
}
"
## kubectl apply -f with label selector should only apply matching objects
# Pre-Condition: no POD exists
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# apply
kubectl apply
-l
unique-label
=
bingbang
-f
hack/testdata/filter
"
${
kube_flags
[@]
}
"
# check right pod exists
kube::test::get_object_assert
'pods selector-test-pod'
"{{
${
labels_field
}
.name}}"
'selector-test-pod'
# check wrong pod doesn't exist
output_message
=
$(
!
kubectl get pods selector-test-pod-dont-apply 2>&1
"
${
kube_flags
[@]
}
"
)
kube::test::if_has_string
"
${
output_message
}
"
'pods "selector-test-pod-dont-apply" not found'
# cleanup
kubectl delete pods selector-test-pod
## kubectl run should create deployments or jobs
# Pre-Condition: no Job exists
kube::test::get_object_assert
jobs
"{{range.items}}{{
$id_field
}}:{{end}}"
''
...
...
hack/testdata/filter/pod-apply-selector.yaml
0 → 100644
View file @
6339d915
apiVersion
:
v1
kind
:
Pod
metadata
:
name
:
selector-test-pod
labels
:
name
:
selector-test-pod
unique-label
:
bingbang
spec
:
containers
:
-
name
:
kubernetes-pause
image
:
gcr.io/google-containers/pause:2.0
hack/testdata/filter/pod-dont-apply.yaml
0 → 100644
View file @
6339d915
apiVersion
:
v1
kind
:
Pod
metadata
:
name
:
selector-test-pod-dont-apply
labels
:
name
:
selector-test-pod-dont-apply
unique-label
:
biz
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