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
29a5cb7a
Commit
29a5cb7a
authored
Nov 16, 2016
by
bprashanth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add clarity/retries to proxy url test
parent
0f95b262
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
networking_utils.go
test/e2e/framework/networking_utils.go
+27
-2
No files found.
test/e2e/framework/networking_utils.go
View file @
29a5cb7a
...
@@ -269,8 +269,33 @@ func (config *NetworkingTestConfig) DialFromNode(protocol, targetIP string, targ
...
@@ -269,8 +269,33 @@ func (config *NetworkingTestConfig) DialFromNode(protocol, targetIP string, targ
func
(
config
*
NetworkingTestConfig
)
GetSelfURL
(
path
string
,
expected
string
)
{
func
(
config
*
NetworkingTestConfig
)
GetSelfURL
(
path
string
,
expected
string
)
{
cmd
:=
fmt
.
Sprintf
(
"curl -q -s --connect-timeout 1 http://localhost:10249%s"
,
path
)
cmd
:=
fmt
.
Sprintf
(
"curl -q -s --connect-timeout 1 http://localhost:10249%s"
,
path
)
By
(
fmt
.
Sprintf
(
"Getting kube-proxy self URL %s"
,
path
))
By
(
fmt
.
Sprintf
(
"Getting kube-proxy self URL %s"
,
path
))
stdout
:=
RunHostCmdOrDie
(
config
.
Namespace
,
config
.
HostTestContainerPod
.
Name
,
cmd
)
Expect
(
strings
.
Contains
(
stdout
,
expected
))
.
To
(
BeTrue
())
// These are arbitrary timeouts. The curl command should pass on first try,
// unless kubeproxy is starved/bootstrapping/restarting etc.
const
retryInterval
=
1
*
time
.
Second
const
retryTimeout
=
30
*
time
.
Second
podName
:=
config
.
HostTestContainerPod
.
Name
var
msg
string
if
pollErr
:=
wait
.
PollImmediate
(
retryInterval
,
retryTimeout
,
func
()
(
bool
,
error
)
{
stdout
,
err
:=
RunHostCmd
(
config
.
Namespace
,
podName
,
cmd
)
if
err
!=
nil
{
msg
=
fmt
.
Sprintf
(
"failed executing cmd %v in %v/%v: %v"
,
cmd
,
config
.
Namespace
,
podName
,
err
)
Logf
(
msg
)
return
false
,
nil
}
if
!
strings
.
Contains
(
stdout
,
expected
)
{
msg
=
fmt
.
Sprintf
(
"successfully executed %v in %v/%v, but output '%v' doesn't contain expected string '%v'"
,
cmd
,
config
.
Namespace
,
podName
,
stdout
,
expected
)
Logf
(
msg
)
return
false
,
nil
}
return
true
,
nil
});
pollErr
!=
nil
{
Logf
(
"
\n
Output of kubectl describe pod %v/%v:
\n
"
,
config
.
Namespace
,
podName
)
desc
,
_
:=
RunKubectl
(
"describe"
,
"pod"
,
podName
,
fmt
.
Sprintf
(
"--namespace=%v"
,
config
.
Namespace
))
Logf
(
"%s"
,
desc
)
Failf
(
"Timed out in %v: %v"
,
retryTimeout
,
msg
)
}
}
}
func
(
config
*
NetworkingTestConfig
)
createNetShellPodSpec
(
podName
string
,
node
string
)
*
api
.
Pod
{
func
(
config
*
NetworkingTestConfig
)
createNetShellPodSpec
(
podName
string
,
node
string
)
*
api
.
Pod
{
...
...
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