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
d3e49591
Commit
d3e49591
authored
Mar 27, 2017
by
Bowei Du
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ping to ip instead of wget google.com in net connectivity check
This is a flakey test and this commit reduces the number of dependent systems involved with the flake.
parent
f14618a5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
util.go
test/e2e/framework/util.go
+15
-5
networking.go
test/e2e/networking.go
+3
-2
No files found.
test/e2e/framework/util.go
View file @
d3e49591
...
...
@@ -4982,11 +4982,21 @@ func LaunchWebserverPod(f *Framework, podName, nodeName string) (ip string) {
return
}
// CheckConnectivityToHost launches a pod running wget on the
// specified node to test connectivity to the specified host. An
// error will be returned if the host is not reachable from the pod.
// CheckConnectivityToHost launches a pod to test connectivity to the specified
// host. An error will be returned if the host is not reachable from the pod.
//
// An empty nodeName will use the schedule to choose where the pod is executed.
func
CheckConnectivityToHost
(
f
*
Framework
,
nodeName
,
podName
,
host
string
,
timeout
int
)
error
{
contName
:=
fmt
.
Sprintf
(
"%s-container"
,
podName
)
command
:=
[]
string
{
"ping"
,
"-c"
,
"3"
,
// send 3 pings
"-W"
,
"2"
,
// wait at most 2 seconds for a reply
"-w"
,
strconv
.
Itoa
(
timeout
),
host
,
}
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
podName
,
...
...
@@ -4996,7 +5006,7 @@ func CheckConnectivityToHost(f *Framework, nodeName, podName, host string, timeo
{
Name
:
contName
,
Image
:
"gcr.io/google_containers/busybox:1.24"
,
Command
:
[]
string
{
"wget"
,
fmt
.
Sprintf
(
"--timeout=%d"
,
timeout
),
"-s"
,
host
}
,
Command
:
command
,
},
},
NodeName
:
nodeName
,
...
...
@@ -5015,7 +5025,7 @@ func CheckConnectivityToHost(f *Framework, nodeName, podName, host string, timeo
if
logErr
!=
nil
{
Logf
(
"Warning: Failed to get logs from pod %q: %v"
,
pod
.
Name
,
logErr
)
}
else
{
Logf
(
"pod %s/%s
\"
wget
\"
logs:
\n
%s"
,
f
.
Namespace
.
Name
,
pod
.
Name
,
logs
)
Logf
(
"pod %s/%s logs:
\n
%s"
,
f
.
Namespace
.
Name
,
pod
.
Name
,
logs
)
}
}
...
...
test/e2e/networking.go
View file @
d3e49591
...
...
@@ -44,8 +44,9 @@ var _ = framework.KubeDescribe("Networking", func() {
})
It
(
"should provide Internet connection for containers [Conformance]"
,
func
()
{
By
(
"Running container which tries to wget google.com"
)
framework
.
ExpectNoError
(
framework
.
CheckConnectivityToHost
(
f
,
""
,
"wget-test"
,
"google.com"
,
30
))
By
(
"Running container which tries to ping 8.8.8.8"
)
framework
.
ExpectNoError
(
framework
.
CheckConnectivityToHost
(
f
,
""
,
"ping-test"
,
"8.8.8.8"
,
30
))
})
// First test because it has no dependencies on variables created later on.
...
...
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