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
a4b6c72f
Commit
a4b6c72f
authored
Mar 06, 2017
by
shashidharatd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a wait for namespaces to appear in federated cluster
parent
e82834e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
util.go
test/e2e_federation/util.go
+21
-0
No files found.
test/e2e_federation/util.go
View file @
a4b6c72f
...
...
@@ -54,6 +54,10 @@ var (
FederatedSvcNodePort
=
int32
(
32256
)
)
const
(
federatedNamespaceTimeout
=
5
*
time
.
Minute
)
var
FederationSuite
common
.
Suite
// cluster keeps track of the assorted objects and state related to each cluster
...
...
@@ -188,6 +192,22 @@ func unregisterClusters(clusters map[string]*cluster, f *fedframework.Framework)
}
}
// waitForNamespaceInFederatedClusters waits for the federated namespace to be created in federated clusters
func
waitForNamespaceInFederatedClusters
(
clusters
map
[
string
]
*
cluster
,
nsName
string
,
timeout
time
.
Duration
)
{
for
name
,
c
:=
range
clusters
{
err
:=
wait
.
PollImmediate
(
framework
.
Poll
,
timeout
,
func
()
(
bool
,
error
)
{
_
,
err
:=
c
.
Clientset
.
Core
()
.
Namespaces
()
.
Get
(
nsName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
By
(
fmt
.
Sprintf
(
"Waiting for namespace %q to be created in cluster %q, err: %v"
,
nsName
,
name
,
err
))
return
false
,
nil
}
By
(
fmt
.
Sprintf
(
"Namespace %q exists in cluster %q"
,
nsName
,
name
))
return
true
,
nil
})
framework
.
ExpectNoError
(
err
,
"Failed to verify federated namespace %q creation in cluster %q"
,
nsName
,
name
)
}
}
// can not be moved to util, as By and Expect must be put in Ginkgo test unit
func
getRegisteredClusters
(
userAgentName
string
,
f
*
fedframework
.
Framework
)
(
map
[
string
]
*
cluster
,
string
)
{
clusters
:=
make
(
map
[
string
]
*
cluster
)
...
...
@@ -209,6 +229,7 @@ func getRegisteredClusters(userAgentName string, f *fedframework.Framework) (map
Expect
(
framework
.
TestContext
.
KubeConfig
)
.
ToNot
(
Equal
(
""
),
"KubeConfig must be specified to load clusters' client config"
)
clusters
[
c
.
Name
]
=
&
cluster
{
c
.
Name
,
createClientsetForCluster
(
c
,
i
,
userAgentName
),
false
,
nil
}
}
waitForNamespaceInFederatedClusters
(
clusters
,
f
.
FederationNamespace
.
Name
,
federatedNamespaceTimeout
)
return
clusters
,
primaryClusterName
}
...
...
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