mirror of
https://github.com/status-im/consul.git
synced 2025-02-12 21:56:46 +00:00
Adds a test to make sure we get the same ID on the second run.
This commit is contained in:
parent
bd605e330c
commit
e719ff8ef1
@ -322,6 +322,15 @@ func TestAgent_NodeID(t *testing.T) {
|
|||||||
t.Fatalf("err: %v", err)
|
t.Fatalf("err: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Running again should get the same ID (persisted in the file).
|
||||||
|
c.NodeID = ""
|
||||||
|
if err := agent.setupNodeID(c); err != nil {
|
||||||
|
t.Fatalf("err: %v", err)
|
||||||
|
}
|
||||||
|
if newID := agent.consulConfig().NodeID; id != newID {
|
||||||
|
t.Fatalf("bad: %q vs %q", id, newID)
|
||||||
|
}
|
||||||
|
|
||||||
// Set an invalid ID via config.
|
// Set an invalid ID via config.
|
||||||
c.NodeID = types.NodeID("nope")
|
c.NodeID = types.NodeID("nope")
|
||||||
err := agent.setupNodeID(c)
|
err := agent.setupNodeID(c)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user