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
e89dbb2a
Commit
e89dbb2a
authored
6 years ago
by
Lang Martin
Browse files
Options
Download
Email Patches
Plain Diff
fix client-test, avoid hardwired platform dependecy on lo0
parent
a7fed726
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/client_test.go
+2
-4
client/client_test.go
with
2 additions
and
4 deletions
+2
-4
client/client_test.go
+
2
-
4
View file @
e89dbb2a
...
...
@@ -1249,6 +1249,7 @@ func TestClient_UpdateNodeFromFingerprintKeepsConfig(t *testing.T) {
// Client without network configured updates to match fingerprint
client
,
cleanup
:=
TestClient
(
t
,
nil
)
defer
cleanup
()
dev
:=
client
.
config
.
Node
.
NodeResources
.
Networks
[
0
]
.
Device
client
.
updateNodeFromFingerprint
(
&
fingerprint
.
FingerprintResponse
{
NodeResources
:
&
structs
.
NodeResources
{
Cpu
:
structs
.
NodeCpuResources
{
CpuShares
:
123
},
...
...
@@ -1267,19 +1268,16 @@ func TestClient_UpdateNodeFromFingerprintKeepsConfig(t *testing.T) {
assert
.
Equal
(
t
,
"any-interface"
,
client
.
config
.
Node
.
Resources
.
Networks
[
0
]
.
Device
)
// Client with network configured keeps the config setting on update
dev
:=
"lo0"
name
:=
"TestClient_UpdateNodeFromFingerprintKeepsConfig2"
client
,
cleanup
=
TestClient
(
t
,
func
(
c
*
config
.
Config
)
{
c
.
NetworkInterface
=
dev
// Node is already a mock.Node, with a hardwired "eth0" device
c
.
Node
.
Name
=
name
// Node is already a mock.Node, with a device
c
.
Node
.
NodeResources
.
Networks
[
0
]
.
Device
=
dev
c
.
Node
.
Resources
.
Networks
=
c
.
Node
.
NodeResources
.
Networks
})
// REVIEW: are both defers going to run? should I just use different names?
defer
cleanup
()
assert
.
Equal
(
t
,
dev
,
client
.
config
.
NetworkInterface
)
assert
.
Equal
(
t
,
dev
,
client
.
config
.
Node
.
NodeResources
.
Networks
[
0
]
.
Device
)
client
.
updateNodeFromFingerprint
(
&
fingerprint
.
FingerprintResponse
{
NodeResources
:
&
structs
.
NodeResources
{
Cpu
:
structs
.
NodeCpuResources
{
CpuShares
:
123
},
...
...
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