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
ca7a9f85
Commit
ca7a9f85
authored
Feb 15, 2016
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always delete namespace in test framework
parent
50ca5460
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
21 deletions
+25
-21
framework.go
test/e2e/framework.go
+25
-21
No files found.
test/e2e/framework.go
View file @
ca7a9f85
...
@@ -134,6 +134,31 @@ func (f *Framework) beforeEach() {
...
@@ -134,6 +134,31 @@ func (f *Framework) beforeEach() {
func
(
f
*
Framework
)
afterEach
()
{
func
(
f
*
Framework
)
afterEach
()
{
RemoveCleanupAction
(
f
.
cleanupHandle
)
RemoveCleanupAction
(
f
.
cleanupHandle
)
// DeleteNamespace at the very end in defer, to avoid any
// expectation failures preventing deleting the namespace.
defer
func
()
{
if
testContext
.
DeleteNamespace
{
for
_
,
ns
:=
range
f
.
namespacesToDelete
{
By
(
fmt
.
Sprintf
(
"Destroying namespace %q for this suite."
,
ns
.
Name
))
timeout
:=
5
*
time
.
Minute
if
f
.
NamespaceDeletionTimeout
!=
0
{
timeout
=
f
.
NamespaceDeletionTimeout
}
if
err
:=
deleteNS
(
f
.
Client
,
ns
.
Name
,
timeout
);
err
!=
nil
{
Failf
(
"Couldn't delete ns %q: %s"
,
ns
.
Name
,
err
)
}
}
f
.
namespacesToDelete
=
nil
}
else
{
Logf
(
"Found DeleteNamespace=false, skipping namespace deletion!"
)
}
// Paranoia-- prevent reuse!
f
.
Namespace
=
nil
f
.
Client
=
nil
}()
// Print events if the test failed.
// Print events if the test failed.
if
CurrentGinkgoTestDescription
()
.
Failed
{
if
CurrentGinkgoTestDescription
()
.
Failed
{
By
(
fmt
.
Sprintf
(
"Collecting events from namespace %q."
,
f
.
Namespace
.
Name
))
By
(
fmt
.
Sprintf
(
"Collecting events from namespace %q."
,
f
.
Namespace
.
Name
))
...
@@ -178,23 +203,6 @@ func (f *Framework) afterEach() {
...
@@ -178,23 +203,6 @@ func (f *Framework) afterEach() {
}
}
}
}
if
testContext
.
DeleteNamespace
{
for
_
,
ns
:=
range
f
.
namespacesToDelete
{
By
(
fmt
.
Sprintf
(
"Destroying namespace %q for this suite."
,
ns
.
Name
))
timeout
:=
5
*
time
.
Minute
if
f
.
NamespaceDeletionTimeout
!=
0
{
timeout
=
f
.
NamespaceDeletionTimeout
}
if
err
:=
deleteNS
(
f
.
Client
,
ns
.
Name
,
timeout
);
err
!=
nil
{
Failf
(
"Couldn't delete ns %q: %s"
,
ns
.
Name
,
err
)
}
}
f
.
namespacesToDelete
=
nil
}
else
{
Logf
(
"Found DeleteNamespace=false, skipping namespace deletion!"
)
}
outputTypes
:=
strings
.
Split
(
testContext
.
OutputPrintType
,
","
)
outputTypes
:=
strings
.
Split
(
testContext
.
OutputPrintType
,
","
)
for
_
,
printType
:=
range
outputTypes
{
for
_
,
printType
:=
range
outputTypes
{
switch
printType
{
switch
printType
{
...
@@ -219,10 +227,6 @@ func (f *Framework) afterEach() {
...
@@ -219,10 +227,6 @@ func (f *Framework) afterEach() {
if
err
:=
allNodesReady
(
f
.
Client
,
time
.
Minute
);
err
!=
nil
{
if
err
:=
allNodesReady
(
f
.
Client
,
time
.
Minute
);
err
!=
nil
{
Failf
(
"All nodes should be ready after test, %v"
,
err
)
Failf
(
"All nodes should be ready after test, %v"
,
err
)
}
}
// Paranoia-- prevent reuse!
f
.
Namespace
=
nil
f
.
Client
=
nil
}
}
func
(
f
*
Framework
)
CreateNamespace
(
baseName
string
,
labels
map
[
string
]
string
)
(
*
api
.
Namespace
,
error
)
{
func
(
f
*
Framework
)
CreateNamespace
(
baseName
string
,
labels
map
[
string
]
string
)
(
*
api
.
Namespace
,
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