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
b6bb1c92
Commit
b6bb1c92
authored
Apr 02, 2018
by
nikhiljindal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a test for kubemci remove-clusters
parent
200bc669
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
9 deletions
+37
-9
ingress_utils.go
test/e2e/framework/ingress_utils.go
+4
-4
util.go
test/e2e/framework/util.go
+5
-5
ingress.go
test/e2e/network/ingress.go
+28
-0
No files found.
test/e2e/framework/ingress_utils.go
View file @
b6bb1c92
...
...
@@ -1170,7 +1170,7 @@ func (j *IngressTestJig) runCreate(ing *extensions.Ingress) (*extensions.Ingress
if
err
:=
manifest
.
IngressToManifest
(
ing
,
filePath
);
err
!=
nil
{
return
nil
,
err
}
_
,
err
:=
r
unKubemciWithKubeconfig
(
"create"
,
ing
.
Name
,
fmt
.
Sprintf
(
"--ingress=%s"
,
filePath
))
_
,
err
:=
R
unKubemciWithKubeconfig
(
"create"
,
ing
.
Name
,
fmt
.
Sprintf
(
"--ingress=%s"
,
filePath
))
return
ing
,
err
}
...
...
@@ -1185,7 +1185,7 @@ func (j *IngressTestJig) runUpdate(ing *extensions.Ingress) (*extensions.Ingress
if
err
:=
manifest
.
IngressToManifest
(
ing
,
filePath
);
err
!=
nil
{
return
nil
,
err
}
_
,
err
:=
r
unKubemciWithKubeconfig
(
"create"
,
ing
.
Name
,
fmt
.
Sprintf
(
"--ingress=%s"
,
filePath
),
"--force"
)
_
,
err
:=
R
unKubemciWithKubeconfig
(
"create"
,
ing
.
Name
,
fmt
.
Sprintf
(
"--ingress=%s"
,
filePath
),
"--force"
)
return
ing
,
err
}
...
...
@@ -1273,7 +1273,7 @@ func (j *IngressTestJig) runDelete(ing *extensions.Ingress) error {
if
err
:=
manifest
.
IngressToManifest
(
ing
,
filePath
);
err
!=
nil
{
return
err
}
_
,
err
:=
r
unKubemciWithKubeconfig
(
"delete"
,
ing
.
Name
,
fmt
.
Sprintf
(
"--ingress=%s"
,
filePath
))
_
,
err
:=
R
unKubemciWithKubeconfig
(
"delete"
,
ing
.
Name
,
fmt
.
Sprintf
(
"--ingress=%s"
,
filePath
))
return
err
}
...
...
@@ -1281,7 +1281,7 @@ func (j *IngressTestJig) runDelete(ing *extensions.Ingress) error {
// TODO(nikhiljindal): Update this to be able to return hostname as well.
func
getIngressAddressFromKubemci
(
name
string
)
([]
string
,
error
)
{
var
addresses
[]
string
out
,
err
:=
r
unKubemciCmd
(
"get-status"
,
name
)
out
,
err
:=
R
unKubemciCmd
(
"get-status"
,
name
)
if
err
!=
nil
{
return
addresses
,
err
}
...
...
test/e2e/framework/util.go
View file @
b6bb1c92
...
...
@@ -2251,17 +2251,17 @@ func RunKubectlOrDieInput(data string, args ...string) string {
return
NewKubectlCommand
(
args
...
)
.
WithStdinData
(
data
)
.
ExecOrDie
()
}
//
runKubemciWithKubeconfig is a convenience wrapper over r
unKubemciCmd
func
r
unKubemciWithKubeconfig
(
args
...
string
)
(
string
,
error
)
{
//
RunKubemciWithKubeconfig is a convenience wrapper over R
unKubemciCmd
func
R
unKubemciWithKubeconfig
(
args
...
string
)
(
string
,
error
)
{
if
TestContext
.
KubeConfig
!=
""
{
args
=
append
(
args
,
"--"
+
clientcmd
.
RecommendedConfigPathFlag
+
"="
+
TestContext
.
KubeConfig
)
}
return
r
unKubemciCmd
(
args
...
)
return
R
unKubemciCmd
(
args
...
)
}
//
r
unKubemciCmd is a convenience wrapper over kubectlBuilder to run kubemci.
//
R
unKubemciCmd is a convenience wrapper over kubectlBuilder to run kubemci.
// It assumes that kubemci exists in PATH.
func
r
unKubemciCmd
(
args
...
string
)
(
string
,
error
)
{
func
R
unKubemciCmd
(
args
...
string
)
(
string
,
error
)
{
// kubemci is assumed to be in PATH.
kubemci
:=
"kubemci"
b
:=
new
(
kubectlBuilder
)
...
...
test/e2e/network/ingress.go
View file @
b6bb1c92
...
...
@@ -630,6 +630,23 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
executeStaticIPHttpsOnlyTest
(
f
,
jig
,
ipName
,
ipAddress
)
})
It
(
"should remove clusters as expected"
,
func
()
{
ingAnnotations
:=
map
[
string
]
string
{
framework
.
IngressStaticIPKey
:
ipName
,
}
ingFilePath
:=
filepath
.
Join
(
framework
.
IngressManifestPath
,
"http"
)
jig
.
CreateIngress
(
ingFilePath
,
ns
,
ingAnnotations
,
map
[
string
]
string
{})
jig
.
WaitForIngress
(
false
/*waitForNodePort*/
)
name
:=
jig
.
Ingress
.
Name
// Verify that the ingress is spread to 1 cluster as expected.
verifyKubemciStatusHas
(
name
,
"is spread across 1 cluster"
)
// Reuse the ingress file created while creating the ingress.
filePath
:=
filepath
.
Join
(
framework
.
TestContext
.
OutputDir
,
"mci.yaml"
)
if
_
,
err
:=
framework
.
RunKubemciWithKubeconfig
(
"remove-clusters"
,
name
,
"--ingress="
+
filePath
);
err
!=
nil
{
framework
.
Failf
(
"unexpected error in running kubemci remove-clusters: %s"
,
err
)
}
verifyKubemciStatusHas
(
name
,
"is spread across 0 cluster"
)
})
})
// Time: borderline 5m, slow by design
...
...
@@ -684,6 +701,17 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
})
})
// verifyKubemciStatusHas fails if kubemci get-status output for the given mci does not have the given expectedSubStr.
func
verifyKubemciStatusHas
(
name
,
expectedSubStr
string
)
{
statusStr
,
err
:=
framework
.
RunKubemciCmd
(
"get-status"
,
name
)
if
err
!=
nil
{
framework
.
Failf
(
"unexpected error in running kubemci get-status %s: %s"
,
name
,
err
)
}
if
!
strings
.
Contains
(
statusStr
,
expectedSubStr
)
{
framework
.
Failf
(
"expected status to have sub string %s, actual status: %s"
,
expectedSubStr
,
statusStr
)
}
}
func
executePresharedCertTest
(
f
*
framework
.
Framework
,
jig
*
framework
.
IngressTestJig
,
staticIPName
string
)
{
preSharedCertName
:=
"test-pre-shared-cert"
By
(
fmt
.
Sprintf
(
"Creating ssl certificate %q on GCE"
,
preSharedCertName
))
...
...
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