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
6e29e84e
Commit
6e29e84e
authored
Dec 11, 2015
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #18532 from thockin/deflake-svcs-e2e
Deflake services e2e
parents
caf4b1e4
ad22d00e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
13 deletions
+20
-13
service.go
test/e2e/service.go
+20
-13
No files found.
test/e2e/service.go
View file @
6e29e84e
...
...
@@ -504,29 +504,36 @@ var _ = Describe("Services", func() {
By
(
"hitting the pod through the service's LoadBalancer"
)
testLoadBalancerReachable
(
ingress1
,
80
)
By
(
"changing service "
+
serviceName
+
" update NodePort"
)
nodePort2
:=
nodePort1
-
1
if
!
ServiceNodePortRange
.
Contains
(
nodePort2
)
{
//Check for (unlikely) assignment at bottom of range
nodePort2
=
nodePort1
+
1
By
(
"changing service "
+
serviceName
+
": update NodePort"
)
nodePort2
:=
0
for
i
:=
1
;
i
<
ServiceNodePortRange
.
Size
;
i
++
{
offs1
:=
nodePort1
-
ServiceNodePortRange
.
Base
offs2
:=
(
offs1
+
i
)
%
ServiceNodePortRange
.
Size
nodePort2
=
ServiceNodePortRange
.
Base
+
offs2
service
,
err
=
updateService
(
f
.
Client
,
f
.
Namespace
.
Name
,
serviceName
,
func
(
s
*
api
.
Service
)
{
s
.
Spec
.
Ports
[
0
]
.
NodePort
=
nodePort2
})
if
err
!=
nil
&&
strings
.
Contains
(
err
.
Error
(),
"provided port is already allocated"
)
{
Logf
(
"nodePort %d is busy, will retry"
,
nodePort2
)
continue
}
// Otherwise err was nil or err was a real error
break
}
service
,
err
=
updateService
(
f
.
Client
,
f
.
Namespace
.
Name
,
serviceName
,
func
(
s
*
api
.
Service
)
{
s
.
Spec
.
Ports
[
0
]
.
NodePort
=
nodePort2
})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
if
service
.
Spec
.
Type
!=
api
.
ServiceTypeLoadBalancer
{
Failf
(
"got unexpected Spec.Type for updated-
NodePort
service: %v"
,
service
)
Failf
(
"got unexpected Spec.Type for updated-
LoadBalancer
service: %v"
,
service
)
}
if
len
(
service
.
Spec
.
Ports
)
!=
1
{
Failf
(
"got unexpected len(Spec.Ports) for updated-
NodePort
service: %v"
,
service
)
Failf
(
"got unexpected len(Spec.Ports) for updated-
LoadBalancer
service: %v"
,
service
)
}
port
=
service
.
Spec
.
Ports
[
0
]
if
port
.
NodePort
!=
nodePort2
{
Failf
(
"got unexpected Spec.Ports[0].nodePort for
NodePort
service: %v"
,
service
)
Failf
(
"got unexpected Spec.Ports[0].nodePort for
LoadBalancer
service: %v"
,
service
)
}
if
len
(
service
.
Status
.
LoadBalancer
.
Ingress
)
!=
1
{
Failf
(
"got unexpected len(Status.LoadBalancer.Ingress) for
NodePort
service: %v"
,
service
)
Failf
(
"got unexpected len(Status.LoadBalancer.Ingress) for
LoadBalancer
service: %v"
,
service
)
}
By
(
"hitting the pod through the service's updated NodePort"
)
...
...
@@ -541,7 +548,7 @@ var _ = Describe("Services", func() {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
ingress2
:=
service
.
Status
.
LoadBalancer
.
Ingress
[
0
]
if
testLoadBalancerReachable
InTime
(
ingress2
,
80
,
5
*
time
.
Second
)
{
if
testLoadBalancerReachable
(
ingress2
,
80
)
{
break
}
...
...
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