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
78493969
Unverified
Commit
78493969
authored
Apr 03, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Apr 03, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #76028 from SataQiu/fix-e2e-framework-20190403
Fix golint failures of e2e/framework/rc_util.go
parents
d5b56f4f
9452461c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
rc_util.go
test/e2e/framework/rc_util.go
+13
-7
No files found.
test/e2e/framework/rc_util.go
View file @
78493969
...
...
@@ -21,7 +21,7 @@ import (
"strings"
"time"
.
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
"k8s.io/api/core/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
...
...
@@ -124,6 +124,10 @@ func ScaleRCByLabels(clientset clientset.Interface, scalesGetter scaleclient.Sca
type
updateRcFunc
func
(
d
*
v1
.
ReplicationController
)
// UpdateReplicationControllerWithRetries retries updating the given rc on conflict with the following steps:
// 1. Get latest resource
// 2. applyUpdate
// 3. Update the resource
func
UpdateReplicationControllerWithRetries
(
c
clientset
.
Interface
,
namespace
,
name
string
,
applyUpdate
updateRcFunc
)
(
*
v1
.
ReplicationController
,
error
)
{
var
rc
*
v1
.
ReplicationController
var
updateErr
error
...
...
@@ -152,12 +156,15 @@ func DeleteRCAndWaitForGC(c clientset.Interface, ns, name string) error {
return
DeleteResourceAndWaitForGC
(
c
,
api
.
Kind
(
"ReplicationController"
),
ns
,
name
)
}
// ScaleRC scales Replication Controller to be desired size.
func
ScaleRC
(
clientset
clientset
.
Interface
,
scalesGetter
scaleclient
.
ScalesGetter
,
ns
,
name
string
,
size
uint
,
wait
bool
)
error
{
return
ScaleResource
(
clientset
,
scalesGetter
,
ns
,
name
,
size
,
wait
,
api
.
Kind
(
"ReplicationController"
),
api
.
Resource
(
"replicationcontrollers"
))
}
// RunRC Launches (and verifies correctness) of a Replication Controller
// and will wait for all pods it spawns to become "Running".
func
RunRC
(
config
testutils
.
RCConfig
)
error
{
By
(
fmt
.
Sprintf
(
"creating replication controller %s in namespace %s"
,
config
.
Name
,
config
.
Namespace
))
ginkgo
.
By
(
fmt
.
Sprintf
(
"creating replication controller %s in namespace %s"
,
config
.
Name
,
config
.
Namespace
))
config
.
NodeDumpFunc
=
DumpNodeDebugInfo
config
.
ContainerDumpFunc
=
LogFailedContainers
return
testutils
.
RunRC
(
config
)
...
...
@@ -180,10 +187,9 @@ func WaitForReplicationController(c clientset.Interface, namespace, name string,
if
err
!=
nil
{
Logf
(
"Get ReplicationController %s in namespace %s failed (%v)."
,
name
,
namespace
,
err
)
return
!
exist
,
nil
}
else
{
Logf
(
"ReplicationController %s in namespace %s found."
,
name
,
namespace
)
return
exist
,
nil
}
Logf
(
"ReplicationController %s in namespace %s found."
,
name
,
namespace
)
return
exist
,
nil
})
if
err
!=
nil
{
stateMsg
:=
map
[
bool
]
string
{
true
:
"to appear"
,
false
:
"to disappear"
}
...
...
@@ -249,13 +255,13 @@ func ValidateController(c clientset.Interface, containerImage string, replicas i
getImageTemplate
:=
fmt
.
Sprintf
(
`--template={{if (exists . "spec" "containers")}}{{range .spec.containers}}{{if eq .name "%s"}}{{.image}}{{end}}{{end}}{{end}}`
,
containername
)
By
(
fmt
.
Sprintf
(
"waiting for all containers in %s pods to come up."
,
testname
))
//testname should be selector
ginkgo
.
By
(
fmt
.
Sprintf
(
"waiting for all containers in %s pods to come up."
,
testname
))
//testname should be selector
waitLoop
:
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
PodStartTimeout
;
time
.
Sleep
(
5
*
time
.
Second
)
{
getPodsOutput
:=
RunKubectlOrDie
(
"get"
,
"pods"
,
"-o"
,
"template"
,
getPodsTemplate
,
"-l"
,
testname
,
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
))
pods
:=
strings
.
Fields
(
getPodsOutput
)
if
numPods
:=
len
(
pods
);
numPods
!=
replicas
{
By
(
fmt
.
Sprintf
(
"Replicas for %s: expected=%d actual=%d"
,
testname
,
replicas
,
numPods
))
ginkgo
.
By
(
fmt
.
Sprintf
(
"Replicas for %s: expected=%d actual=%d"
,
testname
,
replicas
,
numPods
))
continue
}
var
runningPods
[]
string
...
...
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