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
38895a56
Unverified
Commit
38895a56
authored
Aug 13, 2018
by
Nail Islamov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add wait to discovery integration test to fix flakiness
parent
62745905
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
12 deletions
+25
-12
apiserver_test.go
test/integration/examples/apiserver_test.go
+25
-12
No files found.
test/integration/examples/apiserver_test.go
View file @
38895a56
...
...
@@ -334,11 +334,15 @@ func TestAggregatedAPIServer(t *testing.T) {
t
.
Fatal
(
err
)
}
// this is ugly, but sleep just a little bit so that the watch is probably observed. Since nothing will actually be added to discovery
// (the service is missing), we don't have an external signal.
time
.
Sleep
(
100
*
time
.
Millisecond
)
_
,
err
=
aggregatorDiscoveryClient
.
Discovery
()
.
ServerResources
()
assertWardleUnavailableDiscoveryError
(
t
,
err
)
// wait for the unavailable API service to be processed with updated status
err
=
wait
.
Poll
(
100
*
time
.
Millisecond
,
5
*
time
.
Second
,
func
()
(
done
bool
,
err
error
)
{
_
,
err
=
aggregatorDiscoveryClient
.
Discovery
()
.
ServerResources
()
hasExpectedError
:=
checkWardleUnavailableDiscoveryError
(
t
,
err
)
return
hasExpectedError
,
nil
})
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
_
,
err
=
aggregatorClient
.
ApiregistrationV1beta1
()
.
APIServices
()
.
Create
(
&
apiregistrationv1beta1
.
APIService
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"v1."
},
...
...
@@ -359,30 +363,39 @@ func TestAggregatedAPIServer(t *testing.T) {
// (the service is missing), we don't have an external signal.
time
.
Sleep
(
100
*
time
.
Millisecond
)
_
,
err
=
aggregatorDiscoveryClient
.
Discovery
()
.
ServerResources
()
assertWardleUnavailableDiscoveryError
(
t
,
err
)
hasExpectedError
:=
checkWardleUnavailableDiscoveryError
(
t
,
err
)
if
!
hasExpectedError
{
t
.
Fatalf
(
"Discovery call didn't return expected error: %v"
,
err
)
}
// TODO figure out how to turn on enough of services and dns to run more
}
func
assertWardleUnavailableDiscoveryError
(
t
*
testing
.
T
,
err
error
)
{
func
checkWardleUnavailableDiscoveryError
(
t
*
testing
.
T
,
err
error
)
bool
{
if
err
==
nil
{
t
.
Fatal
(
"Discovery call expected to return failed unavailable service"
)
t
.
Log
(
"Discovery call expected to return failed unavailable service"
)
return
false
}
if
!
discovery
.
IsGroupDiscoveryFailedError
(
err
)
{
t
.
Fatalf
(
"Unexpected error: %T, %v"
,
err
,
err
)
t
.
Logf
(
"Unexpected error: %T, %v"
,
err
,
err
)
return
false
}
discoveryErr
:=
err
.
(
*
discovery
.
ErrGroupDiscoveryFailed
)
if
len
(
discoveryErr
.
Groups
)
!=
1
{
t
.
Fatalf
(
"Unexpected failed groups: %v"
,
err
)
t
.
Logf
(
"Unexpected failed groups: %v"
,
err
)
return
false
}
groupVersion
:=
schema
.
GroupVersion
{
Group
:
"wardle.k8s.io"
,
Version
:
"v1alpha1"
}
groupVersionErr
,
ok
:=
discoveryErr
.
Groups
[
groupVersion
]
if
!
ok
{
t
.
Fatalf
(
"Unexpected failed group version: %v"
,
err
)
t
.
Logf
(
"Unexpected failed group version: %v"
,
err
)
return
false
}
if
!
apierrors
.
IsServiceUnavailable
(
groupVersionErr
)
{
t
.
Fatalf
(
"Unexpected failed group version error: %v"
,
err
)
t
.
Logf
(
"Unexpected failed group version error: %v"
,
err
)
return
false
}
return
true
}
func
createKubeConfig
(
clientCfg
*
rest
.
Config
)
*
clientcmdapi
.
Config
{
...
...
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