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
5acd5b52
Unverified
Commit
5acd5b52
authored
Sep 04, 2017
by
Jordan Liggitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tolerate group discovery errors in e2e ns cleanup
parent
0a883230
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
4 deletions
+28
-4
aggregator.go
test/e2e/apimachinery/aggregator.go
+4
-2
util.go
test/e2e/framework/util.go
+24
-2
No files found.
test/e2e/apimachinery/aggregator.go
View file @
5acd5b52
...
...
@@ -70,6 +70,10 @@ var _ = SIGDescribe("Aggregator", func() {
})
func
cleanTest
(
f
*
framework
.
Framework
,
block
bool
)
{
// delete the APIService first to avoid causing discovery errors
aggrclient
:=
f
.
AggregatorClient
_
=
aggrclient
.
ApiregistrationV1beta1
()
.
APIServices
()
.
Delete
(
"v1alpha1.wardle.k8s.io"
,
nil
)
namespace
:=
"sample-system"
client
:=
f
.
ClientSet
_
=
client
.
ExtensionsV1beta1
()
.
Deployments
(
namespace
)
.
Delete
(
"sample-apiserver"
,
nil
)
...
...
@@ -80,8 +84,6 @@ func cleanTest(f *framework.Framework, block bool) {
_
=
client
.
CoreV1
()
.
Namespaces
()
.
Delete
(
namespace
,
nil
)
_
=
client
.
RbacV1beta1
()
.
ClusterRoles
()
.
Delete
(
"wardler"
,
nil
)
_
=
client
.
RbacV1beta1
()
.
ClusterRoleBindings
()
.
Delete
(
"wardler:sample-system:anonymous"
,
nil
)
aggrclient
:=
f
.
AggregatorClient
_
=
aggrclient
.
ApiregistrationV1beta1
()
.
APIServices
()
.
Delete
(
"v1alpha1.wardle.k8s.io"
,
nil
)
if
block
{
_
=
wait
.
Poll
(
100
*
time
.
Millisecond
,
5
*
time
.
Second
,
func
()
(
bool
,
error
)
{
_
,
err
:=
client
.
CoreV1
()
.
Namespaces
()
.
Get
(
"sample-system"
,
metav1
.
GetOptions
{})
...
...
test/e2e/framework/util.go
View file @
5acd5b52
...
...
@@ -1132,6 +1132,28 @@ func countRemainingPods(c clientset.Interface, namespace string) (int, int, erro
return
numPods
,
missingTimestamp
,
nil
}
// isDynamicDiscoveryError returns true if the error is a group discovery error
// only for groups expected to be created/deleted dynamically during e2e tests
func
isDynamicDiscoveryError
(
err
error
)
bool
{
if
!
discovery
.
IsGroupDiscoveryFailedError
(
err
)
{
return
false
}
discoveryErr
:=
err
.
(
*
discovery
.
ErrGroupDiscoveryFailed
)
for
gv
:=
range
discoveryErr
.
Groups
{
switch
gv
.
Group
{
case
"mygroup.example.com"
:
// custom_resource_definition
// garbage_collector
case
"wardle.k8s.io"
:
// aggregator
default
:
Logf
(
"discovery error for unexpected group: %#v"
,
gv
)
return
false
}
}
return
false
}
// hasRemainingContent checks if there is remaining content in the namespace via API discovery
func
hasRemainingContent
(
c
clientset
.
Interface
,
clientPool
dynamic
.
ClientPool
,
namespace
string
)
(
bool
,
error
)
{
// some tests generate their own framework.Client rather than the default
...
...
@@ -1142,11 +1164,11 @@ func hasRemainingContent(c clientset.Interface, clientPool dynamic.ClientPool, n
// find out what content is supported on the server
resources
,
err
:=
c
.
Discovery
()
.
ServerPreferredNamespacedResources
()
if
err
!=
nil
{
if
err
!=
nil
&&
!
isDynamicDiscoveryError
(
err
)
{
return
false
,
err
}
groupVersionResources
,
err
:=
discovery
.
GroupVersionResources
(
resources
)
if
err
!=
nil
{
if
err
!=
nil
&&
!
isDynamicDiscoveryError
(
err
)
{
return
false
,
err
}
...
...
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