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
5036f245
Commit
5036f245
authored
8 years ago
by
Diptanu Choudhury
Browse files
Options
Download
Email Patches
Plain Diff
Attempting to fix alloc status test
parent
7eaefc06
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
api/tasks.go
+1
-1
api/tasks.go
command/alloc_status_test.go
+19
-0
command/alloc_status_test.go
command/util_test.go
+4
-2
command/util_test.go
with
24 additions
and
3 deletions
+24
-3
api/tasks.go
+
1
-
1
View file @
5036f245
...
...
@@ -164,7 +164,7 @@ func NewTask(name, driver string) *Task {
// Configure is used to configure a single k/v pair on
// the task.
func
(
t
*
Task
)
SetConfig
(
key
,
val
string
)
*
Task
{
func
(
t
*
Task
)
SetConfig
(
key
string
,
val
interface
{}
)
*
Task
{
if
t
.
Config
==
nil
{
t
.
Config
=
make
(
map
[
string
]
interface
{})
}
...
...
This diff is collapsed.
Click to expand it.
command/alloc_status_test.go
+
19
-
0
View file @
5036f245
package
command
import
(
"fmt"
"strings"
"testing"
"github.com/hashicorp/nomad/nomad/structs"
"github.com/hashicorp/nomad/testutil"
"github.com/mitchellh/cli"
)
...
...
@@ -78,6 +80,23 @@ func TestAllocStatusCommand_Run(t *testing.T) {
c
.
DevMode
=
true
})
defer
srv
.
Stop
()
// Wait for a node to be ready
testutil
.
WaitForResult
(
func
()
(
bool
,
error
)
{
nodes
,
_
,
err
:=
client
.
Nodes
()
.
List
(
nil
)
if
err
!=
nil
{
return
false
,
err
}
for
_
,
node
:=
range
nodes
{
if
node
.
Status
==
structs
.
NodeStatusReady
{
return
true
,
nil
}
}
return
false
,
fmt
.
Errorf
(
"no ready nodes"
)
},
func
(
err
error
)
{
t
.
Fatalf
(
"err: %v"
,
err
)
})
ui
:=
new
(
cli
.
MockUi
)
cmd
:=
&
AllocStatusCommand
{
Meta
:
Meta
{
Ui
:
ui
}}
...
...
This diff is collapsed.
Click to expand it.
command/util_test.go
+
4
-
2
View file @
5036f245
...
...
@@ -39,8 +39,10 @@ func testServer(
}
func
testJob
(
jobID
string
)
*
api
.
Job
{
task
:=
api
.
NewTask
(
"task1"
,
"raw_exec"
)
.
SetConfig
(
"command"
,
"/bin/sleep"
)
.
task
:=
api
.
NewTask
(
"task1"
,
"mock_driver"
)
.
SetConfig
(
"kill_after"
,
"1s"
)
.
SetConfig
(
"run_for"
,
"5s"
)
.
SetConfig
(
"exit_code"
,
0
)
.
Require
(
&
api
.
Resources
{
MemoryMB
:
256
,
DiskMB
:
20
,
...
...
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