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
fd5cbdf7
Commit
fd5cbdf7
authored
Jan 29, 2016
by
Tim Hockin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename a couple things for obviousness
parent
8d8de2ef
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
19 deletions
+21
-19
cluster_upgrade.go
test/e2e/cluster_upgrade.go
+1
-1
rc.go
test/e2e/rc.go
+1
-1
service.go
test/e2e/service.go
+12
-12
util.go
test/e2e/util.go
+7
-5
No files found.
test/e2e/cluster_upgrade.go
View file @
fd5cbdf7
...
...
@@ -162,7 +162,7 @@ var _ = Describe("Upgrade [Feature:Upgrade]", func() {
})
f
:=
NewFramework
(
"cluster-upgrade"
)
var
w
*
Serv
erTest
var
w
*
Serv
iceTestFixture
BeforeEach
(
func
()
{
By
(
"Setting up the service, RC, and pods"
)
w
=
NewServerTest
(
f
.
Client
,
f
.
Namespace
.
Name
,
svcName
)
...
...
test/e2e/rc.go
View file @
fd5cbdf7
...
...
@@ -112,7 +112,7 @@ func ServeImageOrFail(f *Framework, test string, image string) {
By
(
"Trying to dial each unique pod"
)
retryTimeout
:=
2
*
time
.
Minute
retryInterval
:=
5
*
time
.
Second
err
=
wait
.
Poll
(
retryInterval
,
retryTimeout
,
podResponseChecker
{
f
.
Client
,
f
.
Namespace
.
Name
,
label
,
name
,
true
,
pods
}
.
checkAllResponses
)
err
=
wait
.
Poll
(
retryInterval
,
retryTimeout
,
pod
Proxy
ResponseChecker
{
f
.
Client
,
f
.
Namespace
.
Name
,
label
,
name
,
true
,
pods
}
.
checkAllResponses
)
if
err
!=
nil
{
Failf
(
"Did not get expected responses within the timeout period of %.2f seconds."
,
retryTimeout
.
Seconds
())
}
...
...
test/e2e/service.go
View file @
fd5cbdf7
...
...
@@ -1503,7 +1503,7 @@ func httpGetNoConnectionPool(url string) (*http.Response, error) {
}
// Simple helper class to avoid too much boilerplate in tests
type
Serv
erTest
struct
{
type
Serv
iceTestFixture
struct
{
ServiceName
string
Namespace
string
Client
*
client
.
Client
...
...
@@ -1517,8 +1517,8 @@ type ServerTest struct {
image
string
}
func
NewServerTest
(
client
*
client
.
Client
,
namespace
string
,
serviceName
string
)
*
Serv
erTest
{
t
:=
&
Serv
erTest
{}
func
NewServerTest
(
client
*
client
.
Client
,
namespace
string
,
serviceName
string
)
*
Serv
iceTestFixture
{
t
:=
&
Serv
iceTestFixture
{}
t
.
Client
=
client
t
.
Namespace
=
namespace
t
.
ServiceName
=
serviceName
...
...
@@ -1536,8 +1536,8 @@ func NewServerTest(client *client.Client, namespace string, serviceName string)
return
t
}
func
NewNetcatTest
(
client
*
client
.
Client
,
namespace
string
,
serviceName
string
)
*
Serv
erTest
{
t
:=
&
Serv
erTest
{}
func
NewNetcatTest
(
client
*
client
.
Client
,
namespace
string
,
serviceName
string
)
*
Serv
iceTestFixture
{
t
:=
&
Serv
iceTestFixture
{}
t
.
Client
=
client
t
.
Namespace
=
namespace
t
.
ServiceName
=
serviceName
...
...
@@ -1556,7 +1556,7 @@ func NewNetcatTest(client *client.Client, namespace string, serviceName string)
}
// Build default config for a service (which can then be changed)
func
(
t
*
Serv
erTest
)
BuildServiceSpec
()
*
api
.
Service
{
func
(
t
*
Serv
iceTestFixture
)
BuildServiceSpec
()
*
api
.
Service
{
service
:=
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
t
.
ServiceName
,
...
...
@@ -1575,7 +1575,7 @@ func (t *ServerTest) BuildServiceSpec() *api.Service {
// CreateWebserverRC creates rc-backed pods with the well-known webserver
// configuration and records it for cleanup.
func
(
t
*
Serv
erTest
)
CreateWebserverRC
(
replicas
int
)
*
api
.
ReplicationController
{
func
(
t
*
Serv
iceTestFixture
)
CreateWebserverRC
(
replicas
int
)
*
api
.
ReplicationController
{
rcSpec
:=
rcByNamePort
(
t
.
name
,
replicas
,
t
.
image
,
80
,
api
.
ProtocolTCP
,
t
.
Labels
)
rcAct
,
err
:=
t
.
createRC
(
rcSpec
)
if
err
!=
nil
{
...
...
@@ -1589,7 +1589,7 @@ func (t *ServerTest) CreateWebserverRC(replicas int) *api.ReplicationController
// CreateNetcatRC creates rc-backed pods with a netcat listener
// configuration and records it for cleanup.
func
(
t
*
Serv
erTest
)
CreateNetcatRC
(
replicas
int
)
*
api
.
ReplicationController
{
func
(
t
*
Serv
iceTestFixture
)
CreateNetcatRC
(
replicas
int
)
*
api
.
ReplicationController
{
rcSpec
:=
rcByNamePort
(
t
.
name
,
replicas
,
t
.
image
,
80
,
api
.
ProtocolUDP
,
t
.
Labels
)
rcSpec
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Command
=
[]
string
{
"/bin/bash"
}
rcSpec
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Args
=
[]
string
{
"-c"
,
"echo SUCCESS | nc -q 0 -u -l 0.0.0.0 80"
}
...
...
@@ -1604,7 +1604,7 @@ func (t *ServerTest) CreateNetcatRC(replicas int) *api.ReplicationController {
}
// createRC creates a replication controller and records it for cleanup.
func
(
t
*
Serv
erTest
)
createRC
(
rc
*
api
.
ReplicationController
)
(
*
api
.
ReplicationController
,
error
)
{
func
(
t
*
Serv
iceTestFixture
)
createRC
(
rc
*
api
.
ReplicationController
)
(
*
api
.
ReplicationController
,
error
)
{
rc
,
err
:=
t
.
Client
.
ReplicationControllers
(
t
.
Namespace
)
.
Create
(
rc
)
if
err
==
nil
{
t
.
rcs
[
rc
.
Name
]
=
true
...
...
@@ -1613,7 +1613,7 @@ func (t *ServerTest) createRC(rc *api.ReplicationController) (*api.ReplicationCo
}
// Create a service, and record it for cleanup
func
(
t
*
Serv
erTest
)
CreateService
(
service
*
api
.
Service
)
(
*
api
.
Service
,
error
)
{
func
(
t
*
Serv
iceTestFixture
)
CreateService
(
service
*
api
.
Service
)
(
*
api
.
Service
,
error
)
{
result
,
err
:=
t
.
Client
.
Services
(
t
.
Namespace
)
.
Create
(
service
)
if
err
==
nil
{
t
.
services
[
service
.
Name
]
=
true
...
...
@@ -1622,7 +1622,7 @@ func (t *ServerTest) CreateService(service *api.Service) (*api.Service, error) {
}
// Delete a service, and remove it from the cleanup list
func
(
t
*
Serv
erTest
)
DeleteService
(
serviceName
string
)
error
{
func
(
t
*
Serv
iceTestFixture
)
DeleteService
(
serviceName
string
)
error
{
err
:=
t
.
Client
.
Services
(
t
.
Namespace
)
.
Delete
(
serviceName
)
if
err
==
nil
{
delete
(
t
.
services
,
serviceName
)
...
...
@@ -1630,7 +1630,7 @@ func (t *ServerTest) DeleteService(serviceName string) error {
return
err
}
func
(
t
*
Serv
erTest
)
Cleanup
()
[]
error
{
func
(
t
*
Serv
iceTestFixture
)
Cleanup
()
[]
error
{
var
errs
[]
error
for
rcName
:=
range
t
.
rcs
{
By
(
"stopping RC "
+
rcName
+
" in namespace "
+
t
.
Namespace
)
...
...
test/e2e/util.go
View file @
fd5cbdf7
...
...
@@ -946,8 +946,9 @@ func waitForEndpoint(c *client.Client, ns, name string) error {
return
fmt
.
Errorf
(
"Failed to get entpoints for %s/%s"
,
ns
,
name
)
}
// Context for checking pods responses by issuing GETs to them and verifying if the answer with pod name.
type
podResponseChecker
struct
{
// Context for checking pods responses by issuing GETs to them (via the API
// proxy) and verifying that they answer with ther own pod name.
type
podProxyResponseChecker
struct
{
c
*
client
.
Client
ns
string
label
labels
.
Selector
...
...
@@ -956,8 +957,9 @@ type podResponseChecker struct {
pods
*
api
.
PodList
}
// checkAllResponses issues GETs to all pods in the context and verify they reply with pod name.
func
(
r
podResponseChecker
)
checkAllResponses
()
(
done
bool
,
err
error
)
{
// checkAllResponses issues GETs to all pods in the context and verify they
// reply with their own pod name.
func
(
r
podProxyResponseChecker
)
checkAllResponses
()
(
done
bool
,
err
error
)
{
successes
:=
0
options
:=
api
.
ListOptions
{
LabelSelector
:
r
.
label
}
currentPods
,
err
:=
r
.
c
.
Pods
(
r
.
ns
)
.
List
(
options
)
...
...
@@ -1042,7 +1044,7 @@ func serverVersionGTE(v semver.Version, c client.ServerVersionInterface) (bool,
func
podsResponding
(
c
*
client
.
Client
,
ns
,
name
string
,
wantName
bool
,
pods
*
api
.
PodList
)
error
{
By
(
"trying to dial each unique pod"
)
label
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"name"
:
name
}))
return
wait
.
PollImmediate
(
poll
,
podRespondingTimeout
,
podResponseChecker
{
c
,
ns
,
label
,
name
,
wantName
,
pods
}
.
checkAllResponses
)
return
wait
.
PollImmediate
(
poll
,
podRespondingTimeout
,
pod
Proxy
ResponseChecker
{
c
,
ns
,
label
,
name
,
wantName
,
pods
}
.
checkAllResponses
)
}
func
serviceResponding
(
c
*
client
.
Client
,
ns
,
name
string
)
error
{
...
...
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