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
dd3b7820
Commit
dd3b7820
authored
Oct 19, 2017
by
Jun Xiang Tee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revamp deployment upgrade test
parent
b3a9b802
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
0 deletions
+42
-0
deployment_util.go
test/e2e/framework/deployment_util.go
+19
-0
deployments.go
test/e2e/upgrades/apps/deployments.go
+0
-0
deployment.go
test/utils/deployment.go
+23
-0
No files found.
test/e2e/framework/deployment_util.go
View file @
dd3b7820
...
@@ -289,3 +289,22 @@ func RunDeployment(config testutils.DeploymentConfig) error {
...
@@ -289,3 +289,22 @@ func RunDeployment(config testutils.DeploymentConfig) error {
func
logPodsOfDeployment
(
c
clientset
.
Interface
,
deployment
*
extensions
.
Deployment
,
rsList
[]
*
extensions
.
ReplicaSet
)
{
func
logPodsOfDeployment
(
c
clientset
.
Interface
,
deployment
*
extensions
.
Deployment
,
rsList
[]
*
extensions
.
ReplicaSet
)
{
testutils
.
LogPodsOfDeployment
(
c
,
deployment
,
rsList
,
Logf
)
testutils
.
LogPodsOfDeployment
(
c
,
deployment
,
rsList
,
Logf
)
}
}
func
WaitForDeploymentCompletes
(
c
clientset
.
Interface
,
deployment
*
extensions
.
Deployment
)
error
{
return
testutils
.
WaitForDeploymentCompletes
(
c
,
deployment
,
Logf
,
Poll
,
pollLongTimeout
)
}
func
WaitForDeploymentRevision
(
c
clientset
.
Interface
,
d
*
extensions
.
Deployment
,
targetRevision
string
)
error
{
err
:=
wait
.
PollImmediate
(
Poll
,
pollLongTimeout
,
func
()
(
bool
,
error
)
{
deployment
,
err
:=
c
.
ExtensionsV1beta1
()
.
Deployments
(
d
.
Namespace
)
.
Get
(
d
.
Name
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
return
false
,
err
}
revision
:=
deployment
.
Annotations
[
deploymentutil
.
RevisionAnnotation
]
return
revision
==
targetRevision
,
nil
})
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error waiting for revision to become %q for deployment %q: %v"
,
targetRevision
,
d
.
Name
,
err
)
}
return
nil
}
test/e2e/upgrades/apps/deployments.go
View file @
dd3b7820
This diff is collapsed.
Click to expand it.
test/utils/deployment.go
View file @
dd3b7820
...
@@ -244,3 +244,26 @@ func WaitForObservedDeployment(c clientset.Interface, ns, deploymentName string,
...
@@ -244,3 +244,26 @@ func WaitForObservedDeployment(c clientset.Interface, ns, deploymentName string,
return
c
.
Extensions
()
.
Deployments
(
ns
)
.
Get
(
deploymentName
,
metav1
.
GetOptions
{})
return
c
.
Extensions
()
.
Deployments
(
ns
)
.
Get
(
deploymentName
,
metav1
.
GetOptions
{})
},
desiredGeneration
,
2
*
time
.
Second
,
1
*
time
.
Minute
)
},
desiredGeneration
,
2
*
time
.
Second
,
1
*
time
.
Minute
)
}
}
// Pool until deployment status and its underlying resources reach the desired state.
func
WaitForDeploymentCompletes
(
c
clientset
.
Interface
,
d
*
extensions
.
Deployment
,
logf
LogfFn
,
pollInterval
,
pollTimeout
time
.
Duration
)
error
{
var
reason
string
err
:=
wait
.
PollImmediate
(
pollInterval
,
pollTimeout
,
func
()
(
bool
,
error
)
{
deployment
,
err
:=
c
.
ExtensionsV1beta1
()
.
Deployments
(
d
.
Namespace
)
.
Get
(
d
.
Name
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
return
false
,
err
}
// When the deployment status and its underlying resources reach the desired state, we're done
if
deploymentutil
.
DeploymentComplete
(
d
,
&
deployment
.
Status
)
{
return
true
,
nil
}
reason
=
fmt
.
Sprintf
(
"deployment status: %#v"
,
deployment
.
Status
)
logf
(
reason
)
return
false
,
nil
})
if
err
==
wait
.
ErrWaitTimeout
{
err
=
fmt
.
Errorf
(
"timeout waiting for deployment to complete: %v, most recent deployment status: %s"
,
err
,
reason
)
}
return
err
}
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