package control import "testing" func TestEngineKeysAreTheSameForTheSameReplicaAndNoOther(t *testing.T) { // A control plane that restarts, or a second one, must compute the key a // running engine was started with; a key taken from one node must open // that replica only. a, b := EngineKeys([]byte("s")), EngineKeys([]byte("s")) if a("r1") != b("r1") { t.Error("the same secret gave two keys for one replica") } if a("r1") == a("r2") { t.Error("two replicas share a key") } if a("r1") == EngineKeys([]byte("other"))("r1") { t.Error("the key does not depend on the secret") } }