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
a5ceafc4
Commit
a5ceafc4
authored
Feb 26, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #21175 from caesarxuchao/revert-20202
Auto commit by PR queue bot
parents
e0b305c6
314a6ab7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
9 deletions
+37
-9
test-cmd.sh
hack/test-cmd.sh
+35
-7
resttest.go
pkg/api/rest/resttest/resttest.go
+1
-1
etcd.go
pkg/registry/generic/etcd/etcd.go
+1
-1
No files found.
hack/test-cmd.sh
View file @
a5ceafc4
...
@@ -209,6 +209,20 @@ PATH="${KUBE_OUTPUT_HOSTBIN}":$PATH
...
@@ -209,6 +209,20 @@ PATH="${KUBE_OUTPUT_HOSTBIN}":$PATH
kube::log::status
"Checking kubectl version"
kube::log::status
"Checking kubectl version"
kubectl version
kubectl version
# TODO: we need to note down the current default namespace and set back to this
# namespace after the tests are done.
kubectl config view
CONTEXT
=
"test"
kubectl config set-context
"
${
CONTEXT
}
"
kubectl config use-context
"
${
CONTEXT
}
"
i
=
0
create_and_use_new_namespace
()
{
i
=
$((
$i
+
1
))
kubectl create namespace
"namespace
${
i
}
"
kubectl config set-context
"
${
CONTEXT
}
"
--namespace
=
"namespace
${
i
}
"
}
runTests
()
{
runTests
()
{
version
=
"
$1
"
version
=
"
$1
"
echo
"Testing api version:
$1
"
echo
"Testing api version:
$1
"
...
@@ -311,6 +325,7 @@ runTests() {
...
@@ -311,6 +325,7 @@ runTests() {
### Create POD valid-pod from JSON
### Create POD valid-pod from JSON
# Pre-condition: no POD exists
# Pre-condition: no POD exists
create_and_use_new_namespace
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# Command
# Command
kubectl create
"
${
kube_flags
[@]
}
"
-f
docs/admin/limitrange/valid-pod.yaml
kubectl create
"
${
kube_flags
[@]
}
"
-f
docs/admin/limitrange/valid-pod.yaml
...
@@ -346,9 +361,10 @@ runTests() {
...
@@ -346,9 +361,10 @@ runTests() {
### Create POD valid-pod from dumped YAML
### Create POD valid-pod from dumped YAML
# Pre-condition: no POD exists
# Pre-condition: no POD exists
create_and_use_new_namespace
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# Command
# Command
echo
"
${
output_pod
}
"
| kubectl create
-f
-
"
${
kube_flags
[@]
}
"
echo
"
${
output_pod
}
"
|
sed
'/namespace:/d'
|
kubectl create
-f
-
"
${
kube_flags
[@]
}
"
# Post-condition: valid-pod POD is created
# Post-condition: valid-pod POD is created
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
'valid-pod:'
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
'valid-pod:'
...
@@ -360,8 +376,9 @@ runTests() {
...
@@ -360,8 +376,9 @@ runTests() {
# Post-condition: valid-pod POD doesn't exist
# Post-condition: valid-pod POD doesn't exist
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
### Create POD
redis-master
from JSON
### Create POD
valid-pod
from JSON
# Pre-condition: no POD exists
# Pre-condition: no POD exists
create_and_use_new_namespace
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# Command
# Command
kubectl create
-f
docs/admin/limitrange/valid-pod.yaml
"
${
kube_flags
[@]
}
"
kubectl create
-f
docs/admin/limitrange/valid-pod.yaml
"
${
kube_flags
[@]
}
"
...
@@ -376,8 +393,9 @@ runTests() {
...
@@ -376,8 +393,9 @@ runTests() {
# Post-condition: valid-pod POD doesn't exist
# Post-condition: valid-pod POD doesn't exist
kube::test::get_object_assert
"pods -l'name in (valid-pod)'"
'{{range.items}}{{$id_field}}:{{end}}'
''
kube::test::get_object_assert
"pods -l'name in (valid-pod)'"
'{{range.items}}{{$id_field}}:{{end}}'
''
### Create POD valid-pod from
JSON
### Create POD valid-pod from
YAML
# Pre-condition: no POD exists
# Pre-condition: no POD exists
create_and_use_new_namespace
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# Command
# Command
kubectl create
-f
docs/admin/limitrange/valid-pod.yaml
"
${
kube_flags
[@]
}
"
kubectl create
-f
docs/admin/limitrange/valid-pod.yaml
"
${
kube_flags
[@]
}
"
...
@@ -410,6 +428,7 @@ runTests() {
...
@@ -410,6 +428,7 @@ runTests() {
### Create two PODs
### Create two PODs
# Pre-condition: no POD exists
# Pre-condition: no POD exists
create_and_use_new_namespace
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# Command
# Command
kubectl create
-f
docs/admin/limitrange/valid-pod.yaml
"
${
kube_flags
[@]
}
"
kubectl create
-f
docs/admin/limitrange/valid-pod.yaml
"
${
kube_flags
[@]
}
"
...
@@ -427,6 +446,7 @@ runTests() {
...
@@ -427,6 +446,7 @@ runTests() {
### Create valid-pod POD
### Create valid-pod POD
# Pre-condition: no POD exists
# Pre-condition: no POD exists
create_and_use_new_namespace
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# Command
# Command
kubectl create
-f
docs/admin/limitrange/valid-pod.yaml
"
${
kube_flags
[@]
}
"
kubectl create
-f
docs/admin/limitrange/valid-pod.yaml
"
${
kube_flags
[@]
}
"
...
@@ -451,6 +471,7 @@ runTests() {
...
@@ -451,6 +471,7 @@ runTests() {
### Create valid-pod POD
### Create valid-pod POD
# Pre-condition: no POD exists
# Pre-condition: no POD exists
create_and_use_new_namespace
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# Command
# Command
kubectl create
-f
docs/admin/limitrange/valid-pod.yaml
"
${
kube_flags
[@]
}
"
kubectl create
-f
docs/admin/limitrange/valid-pod.yaml
"
${
kube_flags
[@]
}
"
...
@@ -589,6 +610,7 @@ __EOF__
...
@@ -589,6 +610,7 @@ __EOF__
### Create two PODs from 1 yaml file
### Create two PODs from 1 yaml file
# Pre-condition: no POD exists
# Pre-condition: no POD exists
create_and_use_new_namespace
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# Command
# Command
kubectl create
-f
docs/user-guide/multi-pod.yaml
"
${
kube_flags
[@]
}
"
kubectl create
-f
docs/user-guide/multi-pod.yaml
"
${
kube_flags
[@]
}
"
...
@@ -606,6 +628,7 @@ __EOF__
...
@@ -606,6 +628,7 @@ __EOF__
## kubectl apply should update configuration annotations only if apply is already called
## kubectl apply should update configuration annotations only if apply is already called
## 1. kubectl create doesn't set the annotation
## 1. kubectl create doesn't set the annotation
# Pre-Condition: no POD exists
# Pre-Condition: no POD exists
create_and_use_new_namespace
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# Command: create a pod "test-pod"
# Command: create a pod "test-pod"
kubectl create
-f
hack/testdata/pod.yaml
"
${
kube_flags
[@]
}
"
kubectl create
-f
hack/testdata/pod.yaml
"
${
kube_flags
[@]
}
"
...
@@ -646,6 +669,7 @@ __EOF__
...
@@ -646,6 +669,7 @@ __EOF__
## Configuration annotations should be set when --save-config is enabled
## Configuration annotations should be set when --save-config is enabled
## 1. kubectl create --save-config should generate configuration annotation
## 1. kubectl create --save-config should generate configuration annotation
# Pre-Condition: no POD exists
# Pre-Condition: no POD exists
create_and_use_new_namespace
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# Command: create a pod "test-pod"
# Command: create a pod "test-pod"
kubectl create
-f
hack/testdata/pod.yaml
--save-config
"
${
kube_flags
[@]
}
"
kubectl create
-f
hack/testdata/pod.yaml
--save-config
"
${
kube_flags
[@]
}
"
...
@@ -655,6 +679,7 @@ __EOF__
...
@@ -655,6 +679,7 @@ __EOF__
kubectl delete
-f
hack/testdata/pod.yaml
"
${
kube_flags
[@]
}
"
kubectl delete
-f
hack/testdata/pod.yaml
"
${
kube_flags
[@]
}
"
## 2. kubectl edit --save-config should generate configuration annotation
## 2. kubectl edit --save-config should generate configuration annotation
# Pre-Condition: no POD exists, then create pod "test-pod", which shouldn't have configuration annotation
# Pre-Condition: no POD exists, then create pod "test-pod", which shouldn't have configuration annotation
create_and_use_new_namespace
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kubectl create
-f
hack/testdata/pod.yaml
"
${
kube_flags
[@]
}
"
kubectl create
-f
hack/testdata/pod.yaml
"
${
kube_flags
[@]
}
"
!
[[
"
$(
kubectl get pods test-pod
-o
yaml
"
${
kube_flags
[@]
}
"
|
grep
kubectl.kubernetes.io/last-applied-configuration
)
"
]]
!
[[
"
$(
kubectl get pods test-pod
-o
yaml
"
${
kube_flags
[@]
}
"
|
grep
kubectl.kubernetes.io/last-applied-configuration
)
"
]]
...
@@ -669,6 +694,7 @@ __EOF__
...
@@ -669,6 +694,7 @@ __EOF__
kubectl delete
-f
hack/testdata/pod.yaml
"
${
kube_flags
[@]
}
"
kubectl delete
-f
hack/testdata/pod.yaml
"
${
kube_flags
[@]
}
"
## 3. kubectl replace --save-config should generate configuration annotation
## 3. kubectl replace --save-config should generate configuration annotation
# Pre-Condition: no POD exists, then create pod "test-pod", which shouldn't have configuration annotation
# Pre-Condition: no POD exists, then create pod "test-pod", which shouldn't have configuration annotation
create_and_use_new_namespace
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kubectl create
-f
hack/testdata/pod.yaml
"
${
kube_flags
[@]
}
"
kubectl create
-f
hack/testdata/pod.yaml
"
${
kube_flags
[@]
}
"
!
[[
"
$(
kubectl get pods test-pod
-o
yaml
"
${
kube_flags
[@]
}
"
|
grep
kubectl.kubernetes.io/last-applied-configuration
)
"
]]
!
[[
"
$(
kubectl get pods test-pod
-o
yaml
"
${
kube_flags
[@]
}
"
|
grep
kubectl.kubernetes.io/last-applied-configuration
)
"
]]
...
@@ -687,7 +713,7 @@ __EOF__
...
@@ -687,7 +713,7 @@ __EOF__
[[
"
$(
kubectl get rc nginx
-o
yaml
"
${
kube_flags
[@]
}
"
|
grep
kubectl.kubernetes.io/last-applied-configuration
)
"
]]
[[
"
$(
kubectl get rc nginx
-o
yaml
"
${
kube_flags
[@]
}
"
|
grep
kubectl.kubernetes.io/last-applied-configuration
)
"
]]
## 5. kubectl expose --save-config should generate configuration annotation
## 5. kubectl expose --save-config should generate configuration annotation
# Pre-Condition: no service exists
# Pre-Condition: no service exists
kube::test::get_object_assert svc
"{{range.items}}{{
$id_field
}}:{{end}}"
'
kubernetes:
'
kube::test::get_object_assert svc
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# Command: expose the rc "nginx"
# Command: expose the rc "nginx"
kubectl expose rc nginx
--save-config
--port
=
80
--target-port
=
8000
"
${
kube_flags
[@]
}
"
kubectl expose rc nginx
--save-config
--port
=
80
--target-port
=
8000
"
${
kube_flags
[@]
}
"
# Post-Condition: service "nginx" has configuration annotation
# Post-Condition: service "nginx" has configuration annotation
...
@@ -744,7 +770,8 @@ __EOF__
...
@@ -744,7 +770,8 @@ __EOF__
### Create a new namespace
### Create a new namespace
# Pre-condition: only the "default" namespace exists
# Pre-condition: only the "default" namespace exists
kube::test::get_object_assert namespaces
"{{range.items}}{{
$id_field
}}:{{end}}"
'default:'
# The Pre-condition doesn't hold anymore after we create and switch namespaces before creating pods with same name in the test.
# kube::test::get_object_assert namespaces "{{range.items}}{{$id_field}}:{{end}}" 'default:'
# Command
# Command
kubectl create namespace my-namespace
kubectl create namespace my-namespace
# Post-condition: namespace 'my-namespace' is created.
# Post-condition: namespace 'my-namespace' is created.
...
@@ -884,7 +911,8 @@ __EOF__
...
@@ -884,7 +911,8 @@ __EOF__
############
############
# Services #
# Services #
############
############
# switch back to the default namespace
kubectl config set-context
"
${
CONTEXT
}
"
--namespace
=
""
kube::log::status
"Testing kubectl(
${
version
}
:services)"
kube::log::status
"Testing kubectl(
${
version
}
:services)"
### Create redis-master service from JSON
### Create redis-master service from JSON
...
@@ -1575,7 +1603,7 @@ __EOF__
...
@@ -1575,7 +1603,7 @@ __EOF__
############################
############################
# Pre-condition: the "default" namespace exists
# Pre-condition: the "default" namespace exists
kube::test::get_object_assert namespaces
"{{range.items}}{{
$id_field
}}:
{{end}}"
'default:'
kube::test::get_object_assert namespaces
"{{range.items}}{{
if eq
$id_field
\\\"
default
\\\"
}}{{
$id_field
}}:{{end}}
{{end}}"
'default:'
### Create POD
### Create POD
# Pre-condition: no POD exists
# Pre-condition: no POD exists
...
...
pkg/api/rest/resttest/resttest.go
View file @
a5ceafc4
...
@@ -674,7 +674,7 @@ func (t *Tester) testDeleteGracefulImmediate(obj runtime.Object, setFn SetFunc,
...
@@ -674,7 +674,7 @@ func (t *Tester) testDeleteGracefulImmediate(obj runtime.Object, setFn SetFunc,
}
}
objectMeta
=
t
.
getObjectMetaOrFail
(
out
)
objectMeta
=
t
.
getObjectMetaOrFail
(
out
)
// the second delete shouldn't update the object, so the objectMeta.DeletionGracePeriodSeconds should eqaul to the value set in the first delete.
// the second delete shouldn't update the object, so the objectMeta.DeletionGracePeriodSeconds should eqaul to the value set in the first delete.
if
objectMeta
.
DeletionTimestamp
==
nil
||
objectMeta
.
DeletionGracePeriodSeconds
==
nil
||
*
objectMeta
.
DeletionGracePeriodSeconds
!=
expectedGrace
{
if
objectMeta
.
DeletionTimestamp
==
nil
||
objectMeta
.
DeletionGracePeriodSeconds
==
nil
||
*
objectMeta
.
DeletionGracePeriodSeconds
!=
0
{
t
.
Errorf
(
"unexpected deleted meta: %#v"
,
objectMeta
)
t
.
Errorf
(
"unexpected deleted meta: %#v"
,
objectMeta
)
}
}
}
}
...
...
pkg/registry/generic/etcd/etcd.go
View file @
a5ceafc4
...
@@ -396,7 +396,7 @@ func (e *Etcd) Delete(ctx api.Context, name string, options *api.DeleteOptions)
...
@@ -396,7 +396,7 @@ func (e *Etcd) Delete(ctx api.Context, name string, options *api.DeleteOptions)
if
pendingGraceful
{
if
pendingGraceful
{
return
e
.
finalizeDelete
(
obj
,
false
)
return
e
.
finalizeDelete
(
obj
,
false
)
}
}
if
graceful
&&
*
options
.
GracePeriodSeconds
>
0
{
if
graceful
{
out
:=
e
.
NewFunc
()
out
:=
e
.
NewFunc
()
lastGraceful
:=
int64
(
0
)
lastGraceful
:=
int64
(
0
)
err
:=
e
.
Storage
.
GuaranteedUpdate
(
err
:=
e
.
Storage
.
GuaranteedUpdate
(
...
...
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