Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
1b780931
Commit
1b780931
authored
7 years ago
by
Alex Dadgar
Browse files
Options
Download
Email Patches
Plain Diff
Log more info for TestExecutor_IsolationAndConstraints
parent
7f09b019
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/driver/executor/executor_linux_test.go
+21
-2
client/driver/executor/executor_linux_test.go
with
21 additions
and
2 deletions
+21
-2
client/driver/executor/executor_linux_test.go
+
21
-
2
View file @
1b780931
...
@@ -84,10 +84,21 @@ func TestExecutor_IsolationAndConstraints(t *testing.T) {
...
@@ -84,10 +84,21 @@ func TestExecutor_IsolationAndConstraints(t *testing.T) {
if
ps
.
Pid
==
0
{
if
ps
.
Pid
==
0
{
t
.
Fatalf
(
"expected process to start and have non zero pid"
)
t
.
Fatalf
(
"expected process to start and have non zero pid"
)
}
}
_
,
err
=
executor
.
Wait
()
state
,
err
=
executor
.
Wait
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"error in waiting for command: %v"
,
err
)
t
.
Fatalf
(
"error in waiting for command: %v"
,
err
)
}
}
if
state
.
ExitCode
!=
0
{
t
.
Error
(
"exited with non-zero code: %v"
,
state
.
ExitCode
)
// Log the stderr
file
:=
filepath
.
Join
(
ctx
.
LogDir
,
"web.stderr.0"
)
output
,
err
:=
ioutil
.
ReadFile
(
file
)
if
err
!=
nil
{
t
.
Fatalf
(
"Couldn't read file %v"
,
file
)
}
t
.
Fatalf
(
"ls failed with stderr: %q"
,
string
(
output
))
}
// Check if the resource constraints were applied
// Check if the resource constraints were applied
memLimits
:=
filepath
.
Join
(
ps
.
IsolationConfig
.
CgroupPaths
[
"memory"
],
"memory.limit_in_bytes"
)
memLimits
:=
filepath
.
Join
(
ps
.
IsolationConfig
.
CgroupPaths
[
"memory"
],
"memory.limit_in_bytes"
)
...
@@ -135,8 +146,16 @@ ld.so.conf.d/`
...
@@ -135,8 +146,16 @@ ld.so.conf.d/`
act
:=
strings
.
TrimSpace
(
string
(
output
))
act
:=
strings
.
TrimSpace
(
string
(
output
))
if
act
!=
expected
{
if
act
!=
expected
{
t
.
Fatalf
(
"Command output incorrectly: want %v; got %v"
,
expected
,
act
)
t
.
Errorf
(
"Command output incorrectly: want %v; got %v"
,
expected
,
act
)
}
// Log the stderr
file2
:=
filepath
.
Join
(
ctx
.
LogDir
,
"web.stderr.0"
)
output
,
err
=
ioutil
.
ReadFile
(
file2
)
if
err
!=
nil
{
t
.
Fatalf
(
"Couldn't read file %v"
,
file2
)
}
}
t
.
Fatalf
(
"ls failed with stderr: %q"
,
string
(
output
))
}
}
func
TestExecutor_ClientCleanup
(
t
*
testing
.
T
)
{
func
TestExecutor_ClientCleanup
(
t
*
testing
.
T
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help