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
1ced5ae2
Commit
1ced5ae2
authored
May 12, 2017
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add integration test for deployment
parent
799283f2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
135 additions
and
0 deletions
+135
-0
.linted_packages
hack/.linted_packages
+1
-0
BUILD
test/integration/BUILD
+1
-0
BUILD
test/integration/deployment/BUILD
+56
-0
OWNERS
test/integration/deployment/OWNERS
+6
-0
deployment_test.go
test/integration/deployment/deployment_test.go
+71
-0
util.go
test/integration/deployment/util.go
+0
-0
No files found.
hack/.linted_packages
View file @
1ced5ae2
...
@@ -438,6 +438,7 @@ test/integration/apiserver
...
@@ -438,6 +438,7 @@ test/integration/apiserver
test/integration/client
test/integration/client
test/integration/configmap
test/integration/configmap
test/integration/defaulttolerationseconds
test/integration/defaulttolerationseconds
test/integration/deployment
test/integration/etcd
test/integration/etcd
test/integration/examples
test/integration/examples
test/integration/federation
test/integration/federation
...
...
test/integration/BUILD
View file @
1ced5ae2
...
@@ -39,6 +39,7 @@ filegroup(
...
@@ -39,6 +39,7 @@ filegroup(
"//test/integration/client:all-srcs",
"//test/integration/client:all-srcs",
"//test/integration/configmap:all-srcs",
"//test/integration/configmap:all-srcs",
"//test/integration/defaulttolerationseconds:all-srcs",
"//test/integration/defaulttolerationseconds:all-srcs",
"//test/integration/deployment:all-srcs",
"//test/integration/etcd:all-srcs",
"//test/integration/etcd:all-srcs",
"//test/integration/evictions:all-srcs",
"//test/integration/evictions:all-srcs",
"//test/integration/examples:all-srcs",
"//test/integration/examples:all-srcs",
...
...
test/integration/deployment/BUILD
0 → 100644
View file @
1ced5ae2
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_test",
)
go_test(
name = "go_default_test",
srcs = ["deployment_test.go"],
library = ":go_default_library",
tags = ["automanaged"],
deps = [
"//pkg/api/v1:go_default_library",
"//pkg/controller/deployment/util:go_default_library",
"//test/integration/framework:go_default_library",
],
)
go_library(
name = "go_default_library",
srcs = ["util.go"],
tags = ["automanaged"],
deps = [
"//pkg/api/v1:go_default_library",
"//pkg/api/v1/pod:go_default_library",
"//pkg/apis/extensions/v1beta1:go_default_library",
"//pkg/client/clientset_generated/clientset:go_default_library",
"//pkg/client/informers/informers_generated/externalversions:go_default_library",
"//pkg/controller/deployment:go_default_library",
"//pkg/controller/deployment/util:go_default_library",
"//pkg/controller/replicaset:go_default_library",
"//pkg/util/labels:go_default_library",
"//test/integration/framework:go_default_library",
"//vendor/github.com/davecgh/go-spew/spew:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)
test/integration/deployment/OWNERS
0 → 100644
View file @
1ced5ae2
reviewers:
- janetkuo
- kargakis
approvers:
- janetkuo
- kargakis
test/integration/deployment/deployment_test.go
0 → 100644
View file @
1ced5ae2
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
deployment
import
(
"testing"
"k8s.io/kubernetes/pkg/api/v1"
deploymentutil
"k8s.io/kubernetes/pkg/controller/deployment/util"
"k8s.io/kubernetes/test/integration/framework"
)
func
TestNewDeployment
(
t
*
testing
.
T
)
{
s
,
closeFn
,
rm
,
dc
,
informers
,
c
:=
dcSetup
(
t
)
defer
closeFn
()
name
:=
"test-new-deployment"
ns
:=
framework
.
CreateTestingNamespace
(
name
,
s
,
t
)
defer
framework
.
DeleteTestingNamespace
(
ns
,
s
,
t
)
replicas
:=
int32
(
20
)
tester
:=
&
deploymentTester
{
t
:
t
,
c
:
c
,
deployment
:
newDeployment
(
name
,
ns
.
Name
,
replicas
)}
tester
.
deployment
.
Spec
.
MinReadySeconds
=
4
tester
.
deployment
.
Annotations
=
map
[
string
]
string
{
"test"
:
"should-copy-to-replica-set"
,
v1
.
LastAppliedConfigAnnotation
:
"should-not-copy-to-replica-set"
}
deploy
,
err
:=
c
.
Extensions
()
.
Deployments
(
ns
.
Name
)
.
Create
(
tester
.
deployment
)
if
err
!=
nil
{
t
.
Fatalf
(
"failed to create deployment %s: %v"
,
deploy
.
Name
,
err
)
}
// Start informer and controllers
stopCh
:=
make
(
chan
struct
{})
defer
close
(
stopCh
)
informers
.
Start
(
stopCh
)
go
rm
.
Run
(
5
,
stopCh
)
go
dc
.
Run
(
5
,
stopCh
)
// Wait for the Deployment to be updated to revision 1
err
=
tester
.
waitForDeploymentRevisionAndImage
(
"1"
,
fakeImage
)
if
err
!=
nil
{
t
.
Fatalf
(
"failed to wait for Deployment revision %s: %v"
,
deploy
.
Name
,
err
)
}
// Make sure the Deployment status becomes valid while manually marking Deployment pods as ready at the same time
tester
.
waitForDeploymentStatusValidAndMarkPodsReady
()
// Check new RS annotations
newRS
,
err
:=
deploymentutil
.
GetNewReplicaSet
(
deploy
,
c
)
if
err
!=
nil
{
t
.
Fatalf
(
"failed to get new ReplicaSet of Deployment %s: %v"
,
deploy
.
Name
,
err
)
}
if
newRS
.
Annotations
[
"test"
]
!=
"should-copy-to-replica-set"
{
t
.
Errorf
(
"expected new ReplicaSet annotations copied from Deployment %s, got: %v"
,
deploy
.
Name
,
newRS
.
Annotations
)
}
if
newRS
.
Annotations
[
v1
.
LastAppliedConfigAnnotation
]
!=
""
{
t
.
Errorf
(
"expected new ReplicaSet last-applied annotation not copied from Deployment %s"
,
deploy
.
Name
)
}
}
test/integration/deployment/util.go
0 → 100644
View file @
1ced5ae2
This diff is collapsed.
Click to expand it.
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