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
5d582501
Commit
5d582501
authored
Jun 09, 2016
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit test for deployment strategy validation
parent
c88c9584
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
validation_test.go
pkg/apis/extensions/validation/validation_test.go
+12
-0
No files found.
pkg/apis/extensions/validation/validation_test.go
View file @
5d582501
...
@@ -547,6 +547,13 @@ func validDeployment() *extensions.Deployment {
...
@@ -547,6 +547,13 @@ func validDeployment() *extensions.Deployment {
"name"
:
"abc"
,
"name"
:
"abc"
,
},
},
},
},
Strategy
:
extensions
.
DeploymentStrategy
{
Type
:
extensions
.
RollingUpdateDeploymentStrategyType
,
RollingUpdate
:
&
extensions
.
RollingUpdateDeployment
{
MaxSurge
:
intstr
.
FromInt
(
1
),
MaxUnavailable
:
intstr
.
FromInt
(
1
),
},
},
Template
:
api
.
PodTemplateSpec
{
Template
:
api
.
PodTemplateSpec
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Name
:
"abc"
,
...
@@ -604,6 +611,11 @@ func TestValidateDeployment(t *testing.T) {
...
@@ -604,6 +611,11 @@ func TestValidateDeployment(t *testing.T) {
invalidRestartPolicyDeployment
.
Spec
.
Template
.
Spec
.
RestartPolicy
=
api
.
RestartPolicyNever
invalidRestartPolicyDeployment
.
Spec
.
Template
.
Spec
.
RestartPolicy
=
api
.
RestartPolicyNever
errorCases
[
"Unsupported value:
\"
Never
\"
"
]
=
invalidRestartPolicyDeployment
errorCases
[
"Unsupported value:
\"
Never
\"
"
]
=
invalidRestartPolicyDeployment
// must have valid strategy type
invalidStrategyDeployment
:=
validDeployment
()
invalidStrategyDeployment
.
Spec
.
Strategy
.
Type
=
extensions
.
DeploymentStrategyType
(
"randomType"
)
errorCases
[
"supported values: Recreate, RollingUpdate"
]
=
invalidStrategyDeployment
// rollingUpdate should be nil for recreate.
// rollingUpdate should be nil for recreate.
invalidRecreateDeployment
:=
validDeployment
()
invalidRecreateDeployment
:=
validDeployment
()
invalidRecreateDeployment
.
Spec
.
Strategy
=
extensions
.
DeploymentStrategy
{
invalidRecreateDeployment
.
Spec
.
Strategy
=
extensions
.
DeploymentStrategy
{
...
...
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