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
5f184c56
Commit
5f184c56
authored
Sep 06, 2017
by
Kubernetes Submit Queue
Committed by
GitHub
Sep 06, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #52035 from yujuhong/fix-net-util
Automatic merge from submit-queue e2e: retry on 404 error for service reachability tests
parents
3168bd4b
bb50086b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
networking_utils.go
test/e2e/framework/networking_utils.go
+14
-0
service_util.go
test/e2e/framework/service_util.go
+7
-1
network_tiers.go
test/e2e/network/network_tiers.go
+5
-1
No files found.
test/e2e/framework/networking_utils.go
View file @
5f184c56
...
...
@@ -650,11 +650,20 @@ func TestReachableHTTP(ip string, port int, request string, expect string) (bool
return
TestReachableHTTPWithContent
(
ip
,
port
,
request
,
expect
,
nil
)
}
func
TestReachableHTTPWithRetriableErrorCodes
(
ip
string
,
port
int
,
request
string
,
expect
string
,
retriableErrCodes
[]
int
)
(
bool
,
error
)
{
return
TestReachableHTTPWithContentTimeoutWithRetriableErrorCodes
(
ip
,
port
,
request
,
expect
,
nil
,
retriableErrCodes
,
time
.
Second
*
5
)
}
func
TestReachableHTTPWithContent
(
ip
string
,
port
int
,
request
string
,
expect
string
,
content
*
bytes
.
Buffer
)
(
bool
,
error
)
{
return
TestReachableHTTPWithContentTimeout
(
ip
,
port
,
request
,
expect
,
content
,
5
*
time
.
Second
)
}
func
TestReachableHTTPWithContentTimeout
(
ip
string
,
port
int
,
request
string
,
expect
string
,
content
*
bytes
.
Buffer
,
timeout
time
.
Duration
)
(
bool
,
error
)
{
return
TestReachableHTTPWithContentTimeoutWithRetriableErrorCodes
(
ip
,
port
,
request
,
expect
,
content
,
[]
int
{},
timeout
)
}
func
TestReachableHTTPWithContentTimeoutWithRetriableErrorCodes
(
ip
string
,
port
int
,
request
string
,
expect
string
,
content
*
bytes
.
Buffer
,
retriableErrCodes
[]
int
,
timeout
time
.
Duration
)
(
bool
,
error
)
{
url
:=
fmt
.
Sprintf
(
"http://%s:%d%s"
,
ip
,
port
,
request
)
if
ip
==
""
{
Failf
(
"Got empty IP for reachability check (%s)"
,
url
)
...
...
@@ -679,6 +688,11 @@ func TestReachableHTTPWithContentTimeout(ip string, port int, request string, ex
return
false
,
nil
}
if
resp
.
StatusCode
!=
200
{
for
_
,
code
:=
range
retriableErrCodes
{
if
resp
.
StatusCode
==
code
{
return
false
,
nil
}
}
return
false
,
fmt
.
Errorf
(
"received non-success return status %q trying to access %s; got body: %s"
,
resp
.
Status
,
url
,
string
(
body
))
}
...
...
test/e2e/framework/service_util.go
View file @
5f184c56
...
...
@@ -832,7 +832,13 @@ func (j *ServiceTestJig) LaunchEchoserverPodOnNode(f *Framework, nodeName, podNa
}
func
(
j
*
ServiceTestJig
)
TestReachableHTTP
(
host
string
,
port
int
,
timeout
time
.
Duration
)
{
if
err
:=
wait
.
PollImmediate
(
Poll
,
timeout
,
func
()
(
bool
,
error
)
{
return
TestReachableHTTP
(
host
,
port
,
"/echo?msg=hello"
,
"hello"
)
});
err
!=
nil
{
j
.
TestReachableHTTPWithRetriableErrorCodes
(
host
,
port
,
[]
int
{},
timeout
)
}
func
(
j
*
ServiceTestJig
)
TestReachableHTTPWithRetriableErrorCodes
(
host
string
,
port
int
,
retriableErrCodes
[]
int
,
timeout
time
.
Duration
)
{
if
err
:=
wait
.
PollImmediate
(
Poll
,
timeout
,
func
()
(
bool
,
error
)
{
return
TestReachableHTTPWithRetriableErrorCodes
(
host
,
port
,
"/echo?msg=hello"
,
"hello"
,
retriableErrCodes
)
});
err
!=
nil
{
Failf
(
"Could not reach HTTP service through %v:%v after %v: %v"
,
host
,
port
,
timeout
,
err
)
}
}
...
...
test/e2e/network/network_tiers.go
View file @
5f184c56
...
...
@@ -18,6 +18,7 @@ package network
import
(
"fmt"
"net/http"
"time"
computealpha
"google.golang.org/api/compute/v0.alpha"
...
...
@@ -153,7 +154,10 @@ func waitAndVerifyLBWithTier(jig *framework.ServiceTestJig, ns, svcName, existin
Expect
(
ingressIP
)
.
To
(
Equal
(
svc
.
Spec
.
LoadBalancerIP
))
}
jig
.
SanityCheckService
(
svc
,
v1
.
ServiceTypeLoadBalancer
)
jig
.
TestReachableHTTP
(
ingressIP
,
svcPort
,
checkTimeout
)
// If the IP has been used by previous test, sometimes we get the lingering
// 404 errors even after the LB is long gone. Tolerate and retry until the
// the new LB is fully established since this feature is still Alpha in GCP.
jig
.
TestReachableHTTPWithRetriableErrorCodes
(
ingressIP
,
svcPort
,
[]
int
{
http
.
StatusNotFound
},
checkTimeout
)
// Verify the network tier matches the desired.
svcNetTier
,
err
:=
gcecloud
.
GetServiceNetworkTier
(
svc
)
...
...
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