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
1561f55c
Commit
1561f55c
authored
Jun 02, 2017
by
Rohit Agarwal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wait for cloud-init to finish before starting tests.
This fixes #46889.
parent
0cff8393
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
run_remote.go
test/e2e_node/runner/remote/run_remote.go
+32
-0
No files found.
test/e2e_node/runner/remote/run_remote.go
View file @
1561f55c
...
...
@@ -590,9 +590,41 @@ func createInstance(imageConfig *internalGCEImage) (string, error) {
}
instanceRunning
=
true
}
// If instance didn't reach running state in time, return with error now.
if
err
!=
nil
{
return
name
,
err
}
// Instance reached running state in time, make sure that cloud-init is complete
if
isCloudInitUsed
(
imageConfig
.
metadata
)
{
cloudInitFinished
:=
false
for
i
:=
0
;
i
<
60
&&
!
cloudInitFinished
;
i
++
{
if
i
>
0
{
time
.
Sleep
(
time
.
Second
*
20
)
}
var
finished
string
finished
,
err
=
remote
.
SSH
(
name
,
"ls"
,
"/var/lib/cloud/instance/boot-finished"
)
if
err
!=
nil
{
err
=
fmt
.
Errorf
(
"instance %s has not finished cloud-init script: %s"
,
name
,
finished
)
continue
}
cloudInitFinished
=
true
}
}
return
name
,
err
}
func
isCloudInitUsed
(
metadata
*
compute
.
Metadata
)
bool
{
if
metadata
==
nil
{
return
false
}
for
_
,
item
:=
range
metadata
.
Items
{
if
item
.
Key
==
"user-data"
&&
strings
.
HasPrefix
(
item
.
Value
,
"#cloud-config"
)
{
return
true
}
}
return
false
}
func
getExternalIp
(
instance
*
compute
.
Instance
)
string
{
for
i
:=
range
instance
.
NetworkInterfaces
{
ni
:=
instance
.
NetworkInterfaces
[
i
]
...
...
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