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
130341b5
Commit
130341b5
authored
Jun 15, 2016
by
k8s-merge-robot
Committed by
GitHub
Jun 15, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #27429 from wojtek-t/fix_services_test
Automatic merge from submit-queue Fix failures in up and down services in large clusters Ref #26687
parents
4c0bbe43
9961b802
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
service.go
test/e2e/service.go
+10
-9
No files found.
test/e2e/service.go
View file @
130341b5
...
@@ -943,12 +943,12 @@ var _ = framework.KubeDescribe("Services", func() {
...
@@ -943,12 +943,12 @@ var _ = framework.KubeDescribe("Services", func() {
svcName
:=
fmt
.
Sprintf
(
"%v.%v"
,
serviceName
,
f
.
Namespace
.
Name
)
svcName
:=
fmt
.
Sprintf
(
"%v.%v"
,
serviceName
,
f
.
Namespace
.
Name
)
By
(
"waiting for endpoints of Service with DNS name "
+
svcName
)
By
(
"waiting for endpoints of Service with DNS name "
+
svcName
)
createExecPodOrFail
(
f
.
Client
,
f
.
Namespace
.
Name
,
"exec
"
)
execPodName
:=
createExecPodOrFail
(
f
.
Client
,
f
.
Namespace
.
Name
,
"execpod-
"
)
cmd
:=
fmt
.
Sprintf
(
"wget -qO- %v"
,
svcName
)
cmd
:=
fmt
.
Sprintf
(
"wget -qO- %v"
,
svcName
)
var
stdout
string
var
stdout
string
if
pollErr
:=
wait
.
PollImmediate
(
framework
.
Poll
,
kubeProxyLagTimeout
,
func
()
(
bool
,
error
)
{
if
pollErr
:=
wait
.
PollImmediate
(
framework
.
Poll
,
kubeProxyLagTimeout
,
func
()
(
bool
,
error
)
{
var
err
error
var
err
error
stdout
,
err
=
framework
.
RunHostCmd
(
f
.
Namespace
.
Name
,
"exec"
,
cmd
)
stdout
,
err
=
framework
.
RunHostCmd
(
f
.
Namespace
.
Name
,
execPodName
,
cmd
)
if
err
!=
nil
{
if
err
!=
nil
{
framework
.
Logf
(
"expected un-ready endpoint for Service %v, stdout: %v, err %v"
,
t
.
name
,
stdout
,
err
)
framework
.
Logf
(
"expected un-ready endpoint for Service %v, stdout: %v, err %v"
,
t
.
name
,
stdout
,
err
)
return
false
,
nil
return
false
,
nil
...
@@ -1094,13 +1094,14 @@ func validateEndpointsOrFail(c *client.Client, namespace, serviceName string, ex
...
@@ -1094,13 +1094,14 @@ func validateEndpointsOrFail(c *client.Client, namespace, serviceName string, ex
// createExecPodOrFail creates a simple busybox pod in a sleep loop used as a
// createExecPodOrFail creates a simple busybox pod in a sleep loop used as a
// vessel for kubectl exec commands.
// vessel for kubectl exec commands.
func
createExecPodOrFail
(
c
*
client
.
Client
,
ns
,
name
string
)
{
// Returns the name of the created pod.
func
createExecPodOrFail
(
c
*
client
.
Client
,
ns
,
generateName
string
)
string
{
framework
.
Logf
(
"Creating new exec pod"
)
framework
.
Logf
(
"Creating new exec pod"
)
immediate
:=
int64
(
0
)
immediate
:=
int64
(
0
)
pod
:=
&
api
.
Pod
{
pod
:=
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
n
ame
,
GenerateName
:
generateN
ame
,
Namespace
:
ns
,
Namespace
:
ns
,
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
TerminationGracePeriodSeconds
:
&
immediate
,
TerminationGracePeriodSeconds
:
&
immediate
,
...
@@ -1113,16 +1114,17 @@ func createExecPodOrFail(c *client.Client, ns, name string) {
...
@@ -1113,16 +1114,17 @@ func createExecPodOrFail(c *client.Client, ns, name string) {
},
},
},
},
}
}
_
,
err
:=
c
.
Pods
(
ns
)
.
Create
(
pod
)
created
,
err
:=
c
.
Pods
(
ns
)
.
Create
(
pod
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
err
=
wait
.
PollImmediate
(
framework
.
Poll
,
5
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
err
=
wait
.
PollImmediate
(
framework
.
Poll
,
5
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
retrievedPod
,
err
:=
c
.
Pods
(
pod
.
Namespace
)
.
Get
(
po
d
.
Name
)
retrievedPod
,
err
:=
c
.
Pods
(
pod
.
Namespace
)
.
Get
(
create
d
.
Name
)
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
nil
return
false
,
nil
}
}
return
retrievedPod
.
Status
.
Phase
==
api
.
PodRunning
,
nil
return
retrievedPod
.
Status
.
Phase
==
api
.
PodRunning
,
nil
})
})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
return
created
.
Name
}
}
func
createPodOrFail
(
c
*
client
.
Client
,
ns
,
name
string
,
labels
map
[
string
]
string
,
containerPorts
[]
api
.
ContainerPort
)
{
func
createPodOrFail
(
c
*
client
.
Client
,
ns
,
name
string
,
labels
map
[
string
]
string
,
containerPorts
[]
api
.
ContainerPort
)
{
...
@@ -1406,8 +1408,7 @@ func stopServeHostnameService(c *client.Client, ns, name string) error {
...
@@ -1406,8 +1408,7 @@ func stopServeHostnameService(c *client.Client, ns, name string) error {
// in the cluster. Each pod in the service is expected to echo its name. These
// in the cluster. Each pod in the service is expected to echo its name. These
// names are compared with the given expectedPods list after a sort | uniq.
// names are compared with the given expectedPods list after a sort | uniq.
func
verifyServeHostnameServiceUp
(
c
*
client
.
Client
,
ns
,
host
string
,
expectedPods
[]
string
,
serviceIP
string
,
servicePort
int
)
error
{
func
verifyServeHostnameServiceUp
(
c
*
client
.
Client
,
ns
,
host
string
,
expectedPods
[]
string
,
serviceIP
string
,
servicePort
int
)
error
{
execPodName
:=
"execpod"
execPodName
:=
createExecPodOrFail
(
c
,
ns
,
"execpod-"
)
createExecPodOrFail
(
c
,
ns
,
execPodName
)
defer
func
()
{
defer
func
()
{
deletePodOrFail
(
c
,
ns
,
execPodName
)
deletePodOrFail
(
c
,
ns
,
execPodName
)
}()
}()
...
...
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