1
0
mirror of https://github.com/moby/moby.git synced 2025-07-30 18:23:29 +03:00

Fix daemon key file location

Fixes #10233

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
Derek McGowan
2015-01-21 08:14:30 -08:00
parent f1bc0376b8
commit 06af013f8b
3 changed files with 45 additions and 3 deletions

View File

@ -10,6 +10,8 @@ import (
"os/exec"
"strings"
"testing"
"github.com/docker/libtrust"
)
func TestDaemonRestartWithRunningContainersPorts(t *testing.T) {
@ -350,3 +352,24 @@ func TestDaemonVolumesBindsRefs(t *testing.T) {
logDone("daemon - bind refs in data-containers survive daemon restart")
}
func TestDaemonKeyGeneration(t *testing.T) {
os.Remove("/etc/docker/key.json")
d := NewDaemon(t)
if err := d.Start(); err != nil {
t.Fatalf("Could not start daemon: %v", err)
}
d.Stop()
k, err := libtrust.LoadKeyFile("/etc/docker/key.json")
if err != nil {
t.Fatalf("Error opening key file")
}
kid := k.KeyID()
// Test Key ID is a valid fingerprint (e.g. QQXN:JY5W:TBXI:MK3X:GX6P:PD5D:F56N:NHCS:LVRZ:JA46:R24J:XEFF)
if len(kid) != 59 {
t.Fatalf("Bad key ID: %s", kid)
}
logDone("daemon - key generation")
}