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
0aa5c16f
Commit
0aa5c16f
authored
Oct 05, 2015
by
Alex Robinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14646 from mesosphere/sttts-fix-kubeproxy-test
Fix e2e tests for providers without SSH to the nodes
parents
b1461be2
b041d4ec
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
26 deletions
+39
-26
docker-compose.yml
cluster/mesos/docker/docker-compose.yml
+1
-1
core.go
test/e2e/core.go
+1
-1
kubeproxy.go
test/e2e/kubeproxy.go
+9
-6
privileged.go
test/e2e/privileged.go
+1
-0
service.go
test/e2e/service.go
+23
-17
ssh.go
test/e2e/ssh.go
+1
-1
util.go
test/e2e/util.go
+3
-0
No files found.
cluster/mesos/docker/docker-compose.yml
View file @
0aa5c16f
...
@@ -47,7 +47,7 @@ mesosslave:
...
@@ -47,7 +47,7 @@ mesosslave:
-
MESOS_PORT=5051
-
MESOS_PORT=5051
-
MESOS_LOG_DIR=/var/log/mesos
-
MESOS_LOG_DIR=/var/log/mesos
-
MESOS_LOGGING_LEVEL=INFO
-
MESOS_LOGGING_LEVEL=INFO
-
MESOS_RESOURCES=cpus:4;mem:1280;disk:25600;ports:[
21
000-21099]
-
MESOS_RESOURCES=cpus:4;mem:1280;disk:25600;ports:[
8
000-21099]
-
MESOS_SWITCH_USER=0
-
MESOS_SWITCH_USER=0
-
MESOS_CONTAINERIZERS=docker,mesos
-
MESOS_CONTAINERIZERS=docker,mesos
-
DOCKER_DAEMON_ARGS
-
DOCKER_DAEMON_ARGS
...
...
test/e2e/core.go
View file @
0aa5c16f
...
@@ -38,7 +38,7 @@ func CoreDump(dir string) {
...
@@ -38,7 +38,7 @@ func CoreDump(dir string) {
provider
:=
testContext
.
Provider
provider
:=
testContext
.
Provider
// requires ssh
// requires ssh
if
!
providerIs
(
"gce"
,
"gke"
)
{
if
!
providerIs
(
providersWithSSH
...
)
{
fmt
.
Printf
(
"Skipping SSH core dump, which is not implemented for %s"
,
provider
)
fmt
.
Printf
(
"Skipping SSH core dump, which is not implemented for %s"
,
provider
)
return
return
}
}
...
...
test/e2e/kubeproxy.go
View file @
0aa5c16f
...
@@ -68,7 +68,10 @@ var _ = Describe("KubeProxy", func() {
...
@@ -68,7 +68,10 @@ var _ = Describe("KubeProxy", func() {
config
:=
&
KubeProxyTestConfig
{
config
:=
&
KubeProxyTestConfig
{
f
:
f
,
f
:
f
,
}
}
It
(
"should test kube-proxy"
,
func
()
{
It
(
"should test kube-proxy"
,
func
()
{
SkipUnlessProviderIs
(
providersWithSSH
...
)
By
(
"cleaning up any pre-existing namespaces used by this test"
)
By
(
"cleaning up any pre-existing namespaces used by this test"
)
config
.
cleanup
()
config
.
cleanup
()
...
@@ -164,7 +167,7 @@ func (config *KubeProxyTestConfig) hitClusterIP(epCount int) {
...
@@ -164,7 +167,7 @@ func (config *KubeProxyTestConfig) hitClusterIP(epCount int) {
}
}
func
(
config
*
KubeProxyTestConfig
)
hitNodePort
(
epCount
int
)
{
func
(
config
*
KubeProxyTestConfig
)
hitNodePort
(
epCount
int
)
{
node1_IP
:=
strings
.
TrimSuffix
(
config
.
nodes
[
0
],
":22"
)
node1_IP
:=
config
.
nodes
[
0
]
tries
:=
epCount
*
epCount
+
5
// + 10 if epCount == 0
tries
:=
epCount
*
epCount
+
5
// + 10 if epCount == 0
By
(
"dialing(udp) node1 --> node1:nodeUdpPort"
)
By
(
"dialing(udp) node1 --> node1:nodeUdpPort"
)
config
.
dialFromNode
(
"udp"
,
node1_IP
,
nodeUdpPort
,
tries
,
epCount
)
config
.
dialFromNode
(
"udp"
,
node1_IP
,
nodeUdpPort
,
tries
,
epCount
)
...
@@ -188,7 +191,7 @@ func (config *KubeProxyTestConfig) hitNodePort(epCount int) {
...
@@ -188,7 +191,7 @@ func (config *KubeProxyTestConfig) hitNodePort(epCount int) {
By
(
"Test disabled. dialing(http) node --> 127.0.0.1:nodeHttpPort"
)
By
(
"Test disabled. dialing(http) node --> 127.0.0.1:nodeHttpPort"
)
//config.dialFromNode("http", "127.0.0.1", nodeHttpPort, tries, epCount)
//config.dialFromNode("http", "127.0.0.1", nodeHttpPort, tries, epCount)
node2_IP
:=
strings
.
TrimSuffix
(
config
.
nodes
[
1
],
":22"
)
node2_IP
:=
config
.
nodes
[
1
]
By
(
"dialing(udp) node1 --> node2:nodeUdpPort"
)
By
(
"dialing(udp) node1 --> node2:nodeUdpPort"
)
config
.
dialFromNode
(
"udp"
,
node2_IP
,
nodeUdpPort
,
tries
,
epCount
)
config
.
dialFromNode
(
"udp"
,
node2_IP
,
nodeUdpPort
,
tries
,
epCount
)
By
(
"dialing(http) node1 --> node2:nodeHttpPort"
)
By
(
"dialing(http) node1 --> node2:nodeHttpPort"
)
...
@@ -249,7 +252,7 @@ func (config *KubeProxyTestConfig) dialFromNode(protocol, targetIP string, targe
...
@@ -249,7 +252,7 @@ func (config *KubeProxyTestConfig) dialFromNode(protocol, targetIP string, targe
}
}
func
(
config
*
KubeProxyTestConfig
)
ssh
(
cmd
string
)
string
{
func
(
config
*
KubeProxyTestConfig
)
ssh
(
cmd
string
)
string
{
stdout
,
_
,
code
,
err
:=
SSH
(
cmd
,
config
.
nodes
[
0
],
testContext
.
Provider
)
stdout
,
_
,
code
,
err
:=
SSH
(
cmd
,
config
.
nodes
[
0
]
+
":22"
,
testContext
.
Provider
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"error while SSH-ing to node: %v (code %v)"
,
err
,
code
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"error while SSH-ing to node: %v (code %v)"
,
err
,
code
)
Expect
(
code
)
.
Should
(
BeZero
(),
"command exited with non-zero code %v. cmd:%s"
,
code
,
cmd
)
Expect
(
code
)
.
Should
(
BeZero
(),
"command exited with non-zero code %v. cmd:%s"
,
code
,
cmd
)
return
stdout
return
stdout
...
@@ -421,10 +424,10 @@ func (config *KubeProxyTestConfig) setup() {
...
@@ -421,10 +424,10 @@ func (config *KubeProxyTestConfig) setup() {
By
(
"Getting ssh-able hosts"
)
By
(
"Getting ssh-able hosts"
)
hosts
,
err
:=
NodeSSHHosts
(
config
.
f
.
Client
)
hosts
,
err
:=
NodeSSHHosts
(
config
.
f
.
Client
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
if
len
(
hosts
)
==
0
{
config
.
nodes
=
make
([]
string
,
0
,
len
(
hosts
))
Failf
(
"No ssh-able nodes"
)
for
_
,
h
:=
range
hosts
{
config
.
nodes
=
append
(
config
.
nodes
,
strings
.
TrimSuffix
(
h
,
":22"
))
}
}
config
.
nodes
=
hosts
if
enableLoadBalancerTest
{
if
enableLoadBalancerTest
{
By
(
"Creating the LoadBalancer Service on top of the pods in kubernetes"
)
By
(
"Creating the LoadBalancer Service on top of the pods in kubernetes"
)
...
...
test/e2e/privileged.go
View file @
0aa5c16f
...
@@ -52,6 +52,7 @@ var _ = Describe("PrivilegedPod", func() {
...
@@ -52,6 +52,7 @@ var _ = Describe("PrivilegedPod", func() {
f
:
f
,
f
:
f
,
}
}
It
(
"should test privileged pod"
,
func
()
{
It
(
"should test privileged pod"
,
func
()
{
SkipUnlessProviderIs
(
providersWithSSH
...
)
By
(
"Getting ssh-able hosts"
)
By
(
"Getting ssh-able hosts"
)
hosts
,
err
:=
NodeSSHHosts
(
config
.
f
.
Client
)
hosts
,
err
:=
NodeSSHHosts
(
config
.
f
.
Client
)
...
...
test/e2e/service.go
View file @
0aa5c16f
...
@@ -238,7 +238,7 @@ var _ = Describe("Services", func() {
...
@@ -238,7 +238,7 @@ var _ = Describe("Services", func() {
It
(
"should be able to up and down services"
,
func
()
{
It
(
"should be able to up and down services"
,
func
()
{
// this test uses NodeSSHHosts that does not work if a Node only reports LegacyHostIP
// this test uses NodeSSHHosts that does not work if a Node only reports LegacyHostIP
SkipUnlessProviderIs
(
"gce"
,
"gke"
,
"aws"
)
SkipUnlessProviderIs
(
providersWithSSH
...
)
ns
:=
namespaces
[
0
]
ns
:=
namespaces
[
0
]
numPods
,
servicePort
:=
3
,
80
numPods
,
servicePort
:=
3
,
80
...
@@ -532,14 +532,17 @@ var _ = Describe("Services", func() {
...
@@ -532,14 +532,17 @@ var _ = Describe("Services", func() {
ip
:=
pickNodeIP
(
c
)
ip
:=
pickNodeIP
(
c
)
testReachable
(
ip
,
nodePort
)
testReachable
(
ip
,
nodePort
)
hosts
,
err
:=
NodeSSHHosts
(
c
)
// this test uses NodeSSHHosts that does not work if a Node only reports LegacyHostIP
if
err
!=
nil
{
if
providerIs
(
providersWithSSH
...
)
{
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
hosts
,
err
:=
NodeSSHHosts
(
c
)
}
if
err
!=
nil
{
cmd
:=
fmt
.
Sprintf
(
`test -n "$(ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN)"`
,
nodePort
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
_
,
_
,
code
,
err
:=
SSH
(
cmd
,
hosts
[
0
],
testContext
.
Provider
)
}
if
code
!=
0
{
cmd
:=
fmt
.
Sprintf
(
`test -n "$(ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN)"`
,
nodePort
)
Failf
(
"expected node port (%d) to be in use"
,
nodePort
)
_
,
_
,
code
,
err
:=
SSH
(
cmd
,
hosts
[
0
],
testContext
.
Provider
)
if
code
!=
0
{
Failf
(
"expected node port (%d) to be in use"
,
nodePort
)
}
}
}
})
})
...
@@ -965,14 +968,17 @@ var _ = Describe("Services", func() {
...
@@ -965,14 +968,17 @@ var _ = Describe("Services", func() {
err
=
t
.
DeleteService
(
serviceName
)
err
=
t
.
DeleteService
(
serviceName
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
hosts
,
err
:=
NodeSSHHosts
(
c
)
// this test uses NodeSSHHosts that does not work if a Node only reports LegacyHostIP
if
err
!=
nil
{
if
providerIs
(
providersWithSSH
...
)
{
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
hosts
,
err
:=
NodeSSHHosts
(
c
)
}
if
err
!=
nil
{
cmd
:=
fmt
.
Sprintf
(
`test -n "$(ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN)"`
,
nodePort
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
_
,
_
,
code
,
err
:=
SSH
(
cmd
,
hosts
[
0
],
testContext
.
Provider
)
}
if
code
==
0
{
cmd
:=
fmt
.
Sprintf
(
`test -n "$(ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN)"`
,
nodePort
)
Failf
(
"expected node port (%d) to not be in use"
,
nodePort
)
_
,
_
,
code
,
err
:=
SSH
(
cmd
,
hosts
[
0
],
testContext
.
Provider
)
if
code
==
0
{
Failf
(
"expected node port (%d) to not be in use"
,
nodePort
)
}
}
}
By
(
fmt
.
Sprintf
(
"creating service "
+
serviceName
+
" with same NodePort %d"
,
nodePort
))
By
(
fmt
.
Sprintf
(
"creating service "
+
serviceName
+
" with same NodePort %d"
,
nodePort
))
...
...
test/e2e/ssh.go
View file @
0aa5c16f
...
@@ -35,7 +35,7 @@ var _ = Describe("SSH", func() {
...
@@ -35,7 +35,7 @@ var _ = Describe("SSH", func() {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
// When adding more providers here, also implement their functionality in util.go's getSigner(...).
// When adding more providers here, also implement their functionality in util.go's getSigner(...).
SkipUnlessProviderIs
(
"gce"
,
"gke"
)
SkipUnlessProviderIs
(
providersWithSSH
...
)
})
})
It
(
"should SSH to all nodes and run commands"
,
func
()
{
It
(
"should SSH to all nodes and run commands"
,
func
()
{
...
...
test/e2e/util.go
View file @
0aa5c16f
...
@@ -242,6 +242,9 @@ func providerIs(providers ...string) bool {
...
@@ -242,6 +242,9 @@ func providerIs(providers ...string) bool {
return
false
return
false
}
}
// providersWithSSH are those providers where each node is accessible with SSH
var
providersWithSSH
=
[]
string
{
"gce"
,
"gke"
,
"aws"
}
type
podCondition
func
(
pod
*
api
.
Pod
)
(
bool
,
error
)
type
podCondition
func
(
pod
*
api
.
Pod
)
(
bool
,
error
)
// podReady returns whether pod has a condition of Ready with a status of true.
// podReady returns whether pod has a condition of Ready with a status of true.
...
...
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