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
c61911ee
Commit
c61911ee
authored
Oct 05, 2016
by
MrHohn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #31085, include output checking in retry loop
parent
a6b9e53d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
service.go
test/e2e/service.go
+14
-7
No files found.
test/e2e/service.go
View file @
c61911ee
...
@@ -267,7 +267,7 @@ var _ = framework.KubeDescribe("Services", func() {
...
@@ -267,7 +267,7 @@ var _ = framework.KubeDescribe("Services", func() {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}()
}()
// Waiting for service to expose endpoint
// Waiting for service to expose endpoint
.
validateEndpointsOrFail
(
c
,
ns
,
serviceName
,
PortsByPodName
{
serverPodName
:
{
servicePort
}})
validateEndpointsOrFail
(
c
,
ns
,
serviceName
,
PortsByPodName
{
serverPodName
:
{
servicePort
}})
By
(
"Retrieve sourceip from a pod on the same node"
)
By
(
"Retrieve sourceip from a pod on the same node"
)
...
@@ -2332,25 +2332,32 @@ func execSourceipTest(f *framework.Framework, c *client.Client, ns, nodeName, se
...
@@ -2332,25 +2332,32 @@ func execSourceipTest(f *framework.Framework, c *client.Client, ns, nodeName, se
timeout
:=
2
*
time
.
Minute
timeout
:=
2
*
time
.
Minute
framework
.
Logf
(
"Waiting up to %v for sourceIp test to be executed"
,
timeout
)
framework
.
Logf
(
"Waiting up to %v for sourceIp test to be executed"
,
timeout
)
cmd
:=
fmt
.
Sprintf
(
`wget -T 30 -qO- %s:%d | grep client_address`
,
serviceIp
,
servicePort
)
cmd
:=
fmt
.
Sprintf
(
`wget -T 30 -qO- %s:%d | grep client_address`
,
serviceIp
,
servicePort
)
//
need timeout mechanism because it may takes more times for iptables to be populated
//
Need timeout mechanism because it may takes more times for iptables to be populated.
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
timeout
;
time
.
Sleep
(
2
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
timeout
;
time
.
Sleep
(
2
)
{
stdout
,
err
=
framework
.
RunHostCmd
(
execPod
.
Namespace
,
execPod
.
Name
,
cmd
)
stdout
,
err
=
framework
.
RunHostCmd
(
execPod
.
Namespace
,
execPod
.
Name
,
cmd
)
if
err
!=
nil
{
if
err
!=
nil
{
framework
.
Logf
(
"got err: %v, retry until timeout"
,
err
)
framework
.
Logf
(
"got err: %v, retry until timeout"
,
err
)
continue
continue
}
}
// Need to check output because wget -q might omit the error.
if
strings
.
TrimSpace
(
stdout
)
==
""
{
framework
.
Logf
(
"got empty stdout, retry until timeout"
)
continue
}
break
break
}
}
ExpectNoError
(
err
)
ExpectNoError
(
err
)
//
the stdout return from RunHostCmd seems to come with "\n", so TrimSpace is needed
//
The stdout return from RunHostCmd seems to come with "\n", so TrimSpace is needed.
//
d
esired stdout in this format: client_address=x.x.x.x
//
D
esired stdout in this format: client_address=x.x.x.x
outputs
:=
strings
.
Split
(
strings
.
TrimSpace
(
stdout
),
"="
)
outputs
:=
strings
.
Split
(
strings
.
TrimSpace
(
stdout
),
"="
)
sourceIp
:=
""
if
len
(
outputs
)
!=
2
{
if
len
(
outputs
)
!=
2
{
//
fail the test if output format is unexpected
//
Fail the test if output format is unexpected.
framework
.
Failf
(
"exec pod returned unexpected stdout format: [%v]
\n
"
,
stdout
)
framework
.
Failf
(
"exec pod returned unexpected stdout format: [%v]
\n
"
,
stdout
)
return
execPodIp
,
""
}
else
{
sourceIp
=
outputs
[
1
]
}
}
return
execPodIp
,
outputs
[
1
]
return
execPodIp
,
sourceIp
}
}
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