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
0f597d39
Commit
0f597d39
authored
9 years ago
by
Ryan Uber
Browse files
Options
Download
Email Patches
Plain Diff
command: tests
parent
0d3cbab4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
command/agent_info_test.go
+17
-0
command/agent_info_test.go
command/util_test.go
+37
-0
command/util_test.go
with
54 additions
and
0 deletions
+54
-0
command/agent_info_test.go
0 → 100644
+
17
-
0
View file @
0f597d39
package
command
import
(
"testing"
"github.com/mitchellh/cli"
)
func
TestAgentInfoCommand_Implements
(
t
*
testing
.
T
)
{
var
_
cli
.
Command
=
&
AgentInfoCommand
{}
}
func
TestAgentInfoCommand_Run
(
t
*
testing
.
T
)
{
agent
:=
testAgent
(
t
)
defer
agent
.
Shutdown
()
println
(
"yay"
)
}
This diff is collapsed.
Click to expand it.
command/util_test.go
0 → 100644
+
37
-
0
View file @
0f597d39
package
command
import
(
"sync/atomic"
"testing"
"github.com/hashicorp/nomad/command/agent"
)
var
offset
uint64
func
nextConfig
()
*
agent
.
Config
{
idx
:=
int
(
atomic
.
AddUint64
(
&
offset
,
1
))
conf
:=
agent
.
DefaultConfig
()
conf
.
Region
=
"region1"
conf
.
Datacenter
=
"dc1"
conf
.
NodeName
=
fmt
.
Sprintf
(
"node%d"
,
idx
)
conf
.
BindAddr
=
"127.0.0.1"
conf
.
Server
.
Bootstrap
=
true
conf
.
Server
.
Enabled
=
true
conf
.
Client
.
Enabled
=
false
conf
.
Ports
.
HTTP
=
30000
+
idx
conf
.
Ports
.
Serf
=
32000
+
idx
conf
.
Ports
.
RPC
=
31000
+
idx
return
conf
}
func
testAgent
(
t
*
testing
.
T
)
*
agent
.
Agent
{
conf
:=
nextConfig
()
agent
,
err
:=
agent
.
Create
(
conf
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
return
agent
}
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