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
24eb21e6
Commit
24eb21e6
authored
Sep 25, 2017
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use PollImmediate and shorter interval in integration test
parent
3a0dabca
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
12 deletions
+11
-12
deployment_util.go
test/e2e/framework/deployment_util.go
+1
-1
rs_util.go
test/e2e/framework/rs_util.go
+1
-1
deployment_test.go
test/integration/deployment/deployment_test.go
+1
-2
util.go
test/integration/deployment/util.go
+4
-4
deployment.go
test/utils/deployment.go
+2
-2
replicaset.go
test/utils/replicaset.go
+2
-2
No files found.
test/e2e/framework/deployment_util.go
View file @
24eb21e6
...
@@ -36,7 +36,7 @@ import (
...
@@ -36,7 +36,7 @@ import (
)
)
func
UpdateDeploymentWithRetries
(
c
clientset
.
Interface
,
namespace
,
name
string
,
applyUpdate
testutils
.
UpdateDeploymentFunc
)
(
*
extensions
.
Deployment
,
error
)
{
func
UpdateDeploymentWithRetries
(
c
clientset
.
Interface
,
namespace
,
name
string
,
applyUpdate
testutils
.
UpdateDeploymentFunc
)
(
*
extensions
.
Deployment
,
error
)
{
return
testutils
.
UpdateDeploymentWithRetries
(
c
,
namespace
,
name
,
applyUpdate
,
Logf
)
return
testutils
.
UpdateDeploymentWithRetries
(
c
,
namespace
,
name
,
applyUpdate
,
Logf
,
Poll
,
pollShortTimeout
)
}
}
// Waits for the deployment to clean up old rcs.
// Waits for the deployment to clean up old rcs.
...
...
test/e2e/framework/rs_util.go
View file @
24eb21e6
...
@@ -35,7 +35,7 @@ import (
...
@@ -35,7 +35,7 @@ import (
type
updateRsFunc
func
(
d
*
extensions
.
ReplicaSet
)
type
updateRsFunc
func
(
d
*
extensions
.
ReplicaSet
)
func
UpdateReplicaSetWithRetries
(
c
clientset
.
Interface
,
namespace
,
name
string
,
applyUpdate
testutils
.
UpdateReplicaSetFunc
)
(
*
extensions
.
ReplicaSet
,
error
)
{
func
UpdateReplicaSetWithRetries
(
c
clientset
.
Interface
,
namespace
,
name
string
,
applyUpdate
testutils
.
UpdateReplicaSetFunc
)
(
*
extensions
.
ReplicaSet
,
error
)
{
return
testutils
.
UpdateReplicaSetWithRetries
(
c
,
namespace
,
name
,
applyUpdate
,
Logf
)
return
testutils
.
UpdateReplicaSetWithRetries
(
c
,
namespace
,
name
,
applyUpdate
,
Logf
,
Poll
,
pollShortTimeout
)
}
}
// CheckNewRSAnnotations check if the new RS's annotation is as expected
// CheckNewRSAnnotations check if the new RS's annotation is as expected
...
...
test/integration/deployment/deployment_test.go
View file @
24eb21e6
...
@@ -20,7 +20,6 @@ import (
...
@@ -20,7 +20,6 @@ import (
"reflect"
"reflect"
"strings"
"strings"
"testing"
"testing"
"time"
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
"k8s.io/api/extensions/v1beta1"
"k8s.io/api/extensions/v1beta1"
...
@@ -367,7 +366,7 @@ func TestDeploymentHashCollision(t *testing.T) {
...
@@ -367,7 +366,7 @@ func TestDeploymentHashCollision(t *testing.T) {
}
}
// Expect deployment collision counter to increment
// Expect deployment collision counter to increment
if
err
:=
wait
.
PollImmediate
(
time
.
Second
,
time
.
Minute
,
func
()
(
bool
,
error
)
{
if
err
:=
wait
.
PollImmediate
(
pollInterval
,
pollTimeout
,
func
()
(
bool
,
error
)
{
d
,
err
:=
c
.
ExtensionsV1beta1
()
.
Deployments
(
ns
.
Name
)
.
Get
(
tester
.
deployment
.
Name
,
metav1
.
GetOptions
{})
d
,
err
:=
c
.
ExtensionsV1beta1
()
.
Deployments
(
ns
.
Name
)
.
Get
(
tester
.
deployment
.
Name
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
nil
return
false
,
nil
...
...
test/integration/deployment/util.go
View file @
24eb21e6
...
@@ -38,7 +38,7 @@ import (
...
@@ -38,7 +38,7 @@ import (
)
)
const
(
const
(
pollInterval
=
1
*
time
.
S
econd
pollInterval
=
1
00
*
time
.
Millis
econd
pollTimeout
=
60
*
time
.
Second
pollTimeout
=
60
*
time
.
Second
fakeImageName
=
"fake-name"
fakeImageName
=
"fake-name"
...
@@ -168,7 +168,7 @@ func (d *deploymentTester) markAllPodsReady() {
...
@@ -168,7 +168,7 @@ func (d *deploymentTester) markAllPodsReady() {
d
.
t
.
Fatalf
(
"failed to parse Deployment selector: %v"
,
err
)
d
.
t
.
Fatalf
(
"failed to parse Deployment selector: %v"
,
err
)
}
}
var
readyPods
int32
var
readyPods
int32
err
=
wait
.
Poll
(
100
*
time
.
Millisecond
,
pollTimeout
,
func
()
(
bool
,
error
)
{
err
=
wait
.
Poll
Immediate
(
pollInterval
,
pollTimeout
,
func
()
(
bool
,
error
)
{
readyPods
=
0
readyPods
=
0
pods
,
err
:=
d
.
c
.
Core
()
.
Pods
(
ns
)
.
List
(
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()})
pods
,
err
:=
d
.
c
.
Core
()
.
Pods
(
ns
)
.
List
(
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()})
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -217,7 +217,7 @@ func (d *deploymentTester) waitForDeploymentStatusValidAndMarkPodsReady() error
...
@@ -217,7 +217,7 @@ func (d *deploymentTester) waitForDeploymentStatusValidAndMarkPodsReady() error
}
}
func
(
d
*
deploymentTester
)
updateDeployment
(
applyUpdate
testutil
.
UpdateDeploymentFunc
)
(
*
v1beta1
.
Deployment
,
error
)
{
func
(
d
*
deploymentTester
)
updateDeployment
(
applyUpdate
testutil
.
UpdateDeploymentFunc
)
(
*
v1beta1
.
Deployment
,
error
)
{
return
testutil
.
UpdateDeploymentWithRetries
(
d
.
c
,
d
.
deployment
.
Namespace
,
d
.
deployment
.
Name
,
applyUpdate
,
d
.
t
.
Logf
)
return
testutil
.
UpdateDeploymentWithRetries
(
d
.
c
,
d
.
deployment
.
Namespace
,
d
.
deployment
.
Name
,
applyUpdate
,
d
.
t
.
Logf
,
pollInterval
,
pollTimeout
)
}
}
func
(
d
*
deploymentTester
)
waitForObservedDeployment
(
desiredGeneration
int64
)
error
{
func
(
d
*
deploymentTester
)
waitForObservedDeployment
(
desiredGeneration
int64
)
error
{
...
@@ -258,5 +258,5 @@ func (d *deploymentTester) expectNewReplicaSet() (*v1beta1.ReplicaSet, error) {
...
@@ -258,5 +258,5 @@ func (d *deploymentTester) expectNewReplicaSet() (*v1beta1.ReplicaSet, error) {
}
}
func
(
d
*
deploymentTester
)
updateReplicaSet
(
name
string
,
applyUpdate
testutil
.
UpdateReplicaSetFunc
)
(
*
v1beta1
.
ReplicaSet
,
error
)
{
func
(
d
*
deploymentTester
)
updateReplicaSet
(
name
string
,
applyUpdate
testutil
.
UpdateReplicaSetFunc
)
(
*
v1beta1
.
ReplicaSet
,
error
)
{
return
testutil
.
UpdateReplicaSetWithRetries
(
d
.
c
,
d
.
deployment
.
Namespace
,
name
,
applyUpdate
,
d
.
t
.
Logf
)
return
testutil
.
UpdateReplicaSetWithRetries
(
d
.
c
,
d
.
deployment
.
Namespace
,
name
,
applyUpdate
,
d
.
t
.
Logf
,
pollInterval
,
pollTimeout
)
}
}
test/utils/deployment.go
View file @
24eb21e6
...
@@ -216,10 +216,10 @@ func containsImage(containers []v1.Container, imageName string) bool {
...
@@ -216,10 +216,10 @@ func containsImage(containers []v1.Container, imageName string) bool {
type
UpdateDeploymentFunc
func
(
d
*
extensions
.
Deployment
)
type
UpdateDeploymentFunc
func
(
d
*
extensions
.
Deployment
)
func
UpdateDeploymentWithRetries
(
c
clientset
.
Interface
,
namespace
,
name
string
,
applyUpdate
UpdateDeploymentFunc
,
logf
LogfFn
)
(
*
extensions
.
Deployment
,
error
)
{
func
UpdateDeploymentWithRetries
(
c
clientset
.
Interface
,
namespace
,
name
string
,
applyUpdate
UpdateDeploymentFunc
,
logf
LogfFn
,
pollInterval
,
pollTimeout
time
.
Duration
)
(
*
extensions
.
Deployment
,
error
)
{
var
deployment
*
extensions
.
Deployment
var
deployment
*
extensions
.
Deployment
var
updateErr
error
var
updateErr
error
pollErr
:=
wait
.
PollImmediate
(
1
*
time
.
Second
,
1
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
pollErr
:=
wait
.
PollImmediate
(
pollInterval
,
pollTimeout
,
func
()
(
bool
,
error
)
{
var
err
error
var
err
error
if
deployment
,
err
=
c
.
Extensions
()
.
Deployments
(
namespace
)
.
Get
(
name
,
metav1
.
GetOptions
{});
err
!=
nil
{
if
deployment
,
err
=
c
.
Extensions
()
.
Deployments
(
namespace
)
.
Get
(
name
,
metav1
.
GetOptions
{});
err
!=
nil
{
return
false
,
err
return
false
,
err
...
...
test/utils/replicaset.go
View file @
24eb21e6
...
@@ -28,10 +28,10 @@ import (
...
@@ -28,10 +28,10 @@ import (
type
UpdateReplicaSetFunc
func
(
d
*
extensions
.
ReplicaSet
)
type
UpdateReplicaSetFunc
func
(
d
*
extensions
.
ReplicaSet
)
func
UpdateReplicaSetWithRetries
(
c
clientset
.
Interface
,
namespace
,
name
string
,
applyUpdate
UpdateReplicaSetFunc
,
logf
LogfFn
)
(
*
extensions
.
ReplicaSet
,
error
)
{
func
UpdateReplicaSetWithRetries
(
c
clientset
.
Interface
,
namespace
,
name
string
,
applyUpdate
UpdateReplicaSetFunc
,
logf
LogfFn
,
pollInterval
,
pollTimeout
time
.
Duration
)
(
*
extensions
.
ReplicaSet
,
error
)
{
var
rs
*
extensions
.
ReplicaSet
var
rs
*
extensions
.
ReplicaSet
var
updateErr
error
var
updateErr
error
pollErr
:=
wait
.
PollImmediate
(
1
*
time
.
Second
,
1
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
pollErr
:=
wait
.
PollImmediate
(
pollInterval
,
pollTimeout
,
func
()
(
bool
,
error
)
{
var
err
error
var
err
error
if
rs
,
err
=
c
.
Extensions
()
.
ReplicaSets
(
namespace
)
.
Get
(
name
,
metav1
.
GetOptions
{});
err
!=
nil
{
if
rs
,
err
=
c
.
Extensions
()
.
ReplicaSets
(
namespace
)
.
Get
(
name
,
metav1
.
GetOptions
{});
err
!=
nil
{
return
false
,
err
return
false
,
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