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
69dc4b0f
Commit
69dc4b0f
authored
Nov 22, 2016
by
Jerzy Szczepkowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E tests cleanup: moved generation of regexp for master replica to a separate function.
E2E tests cleanup: moved generation of regexp for master replica to a separate function.
parent
d01998f5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
util.go
test/e2e/framework/util.go
+5
-1
ha_master.go
test/e2e/ha_master.go
+1
-1
No files found.
test/e2e/framework/util.go
View file @
69dc4b0f
...
@@ -4011,6 +4011,10 @@ func WaitForClusterSize(c clientset.Interface, size int, timeout time.Duration)
...
@@ -4011,6 +4011,10 @@ func WaitForClusterSize(c clientset.Interface, size int, timeout time.Duration)
return
fmt
.
Errorf
(
"timeout waiting %v for cluster size to be %d"
,
timeout
,
size
)
return
fmt
.
Errorf
(
"timeout waiting %v for cluster size to be %d"
,
timeout
,
size
)
}
}
func
GenerateMasterRegexp
(
prefix
string
)
string
{
return
prefix
+
"(-...)?"
}
// waitForMasters waits until the cluster has the desired number of ready masters in it.
// waitForMasters waits until the cluster has the desired number of ready masters in it.
func
WaitForMasters
(
masterPrefix
string
,
c
clientset
.
Interface
,
size
int
,
timeout
time
.
Duration
)
error
{
func
WaitForMasters
(
masterPrefix
string
,
c
clientset
.
Interface
,
size
int
,
timeout
time
.
Duration
)
error
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
timeout
;
time
.
Sleep
(
20
*
time
.
Second
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
timeout
;
time
.
Sleep
(
20
*
time
.
Second
)
{
...
@@ -4022,7 +4026,7 @@ func WaitForMasters(masterPrefix string, c clientset.Interface, size int, timeou
...
@@ -4022,7 +4026,7 @@ func WaitForMasters(masterPrefix string, c clientset.Interface, size int, timeou
// Filter out nodes that are not master replicas
// Filter out nodes that are not master replicas
FilterNodes
(
nodes
,
func
(
node
api
.
Node
)
bool
{
FilterNodes
(
nodes
,
func
(
node
api
.
Node
)
bool
{
res
,
err
:=
regexp
.
Match
(
masterPrefix
+
"(-...)?"
,
([]
byte
)(
node
.
Name
))
res
,
err
:=
regexp
.
Match
(
GenerateMasterRegexp
(
masterPrefix
)
,
([]
byte
)(
node
.
Name
))
if
err
!=
nil
{
if
err
!=
nil
{
Logf
(
"Failed to match regexp to node name: %v"
,
err
)
Logf
(
"Failed to match regexp to node name: %v"
,
err
)
return
false
return
false
...
...
test/e2e/ha_master.go
View file @
69dc4b0f
...
@@ -64,7 +64,7 @@ func createNewRC(c clientset.Interface, ns string, name string) {
...
@@ -64,7 +64,7 @@ func createNewRC(c clientset.Interface, ns string, name string) {
func
verifyNumberOfMasterReplicas
(
expected
int
)
{
func
verifyNumberOfMasterReplicas
(
expected
int
)
{
output
,
err
:=
exec
.
Command
(
"gcloud"
,
"compute"
,
"instances"
,
"list"
,
output
,
err
:=
exec
.
Command
(
"gcloud"
,
"compute"
,
"instances"
,
"list"
,
"--project="
+
framework
.
TestContext
.
CloudConfig
.
ProjectID
,
"--project="
+
framework
.
TestContext
.
CloudConfig
.
ProjectID
,
"--regexp="
+
framework
.
TestContext
.
CloudConfig
.
MasterName
+
"(-...)?"
,
"--regexp="
+
framework
.
GenerateMasterRegexp
(
framework
.
TestContext
.
CloudConfig
.
MasterName
)
,
"--filter=status=RUNNING"
,
"--filter=status=RUNNING"
,
"--format=[no-heading]"
)
.
CombinedOutput
()
"--format=[no-heading]"
)
.
CombinedOutput
()
framework
.
Logf
(
"%s"
,
output
)
framework
.
Logf
(
"%s"
,
output
)
...
...
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