mirror of https://github.com/hashicorp/consul
Adds a test to make sure we get the same ID on the second run.
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…
Reference in New Issue