Skip to content

Commit f923321

Browse files
author
Tibor Vass
committed
Add test for keeping same daemon ID on upgrade
Signed-off-by: Tibor Vass <[email protected]>
1 parent 53dad9f commit f923321

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

daemon/config/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ var flatOptions = map[string]bool{
6363
var skipValidateOptions = map[string]bool{
6464
"features": true,
6565
"builder": true,
66+
// Corresponding flag has been removed because it was already unusable
67+
"deprecated-key-path": true,
6668
}
6769

6870
// skipDuplicates contains configuration keys that

integration/config/config_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"bytes"
55
"context"
66
"encoding/json"
7+
"io/ioutil"
8+
"path/filepath"
79
"sort"
810
"testing"
911
"time"
@@ -13,6 +15,7 @@ import (
1315
swarmtypes "github.com/docker/docker/api/types/swarm"
1416
"github.com/docker/docker/client"
1517
"github.com/docker/docker/integration/internal/swarm"
18+
"github.com/docker/docker/internal/test/daemon"
1619
"github.com/docker/docker/pkg/stdcopy"
1720
"gotest.tools/assert"
1821
is "gotest.tools/assert/cmp"
@@ -417,6 +420,26 @@ func TestConfigCreateResolve(t *testing.T) {
417420
assert.Assert(t, is.Equal(0, len(entries)))
418421
}
419422

423+
func TestConfigDaemonLibtrustID(t *testing.T) {
424+
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
425+
defer setupTest(t)()
426+
427+
d := daemon.New(t)
428+
defer d.Stop(t)
429+
430+
trustKey := filepath.Join(d.RootDir(), "key.json")
431+
err := ioutil.WriteFile(trustKey, []byte(`{"crv":"P-256","d":"dm28PH4Z4EbyUN8L0bPonAciAQa1QJmmyYd876mnypY","kid":"WTJ3:YSIP:CE2E:G6KJ:PSBD:YX2Y:WEYD:M64G:NU2V:XPZV:H2CR:VLUB","kty":"EC","x":"Mh5-JINSjaa_EZdXDttri255Z5fbCEOTQIZjAcScFTk","y":"eUyuAjfxevb07hCCpvi4Zi334Dy4GDWQvEToGEX4exQ"}`), 0644)
432+
assert.NilError(t, err)
433+
434+
config := filepath.Join(d.RootDir(), "daemon.json")
435+
err = ioutil.WriteFile(config, []byte(`{"deprecated-key-path": "`+trustKey+`"}`), 0644)
436+
assert.NilError(t, err)
437+
438+
d.Start(t, "--config-file", config)
439+
info := d.Info(t)
440+
assert.Equal(t, info.ID, "WTJ3:YSIP:CE2E:G6KJ:PSBD:YX2Y:WEYD:M64G:NU2V:XPZV:H2CR:VLUB")
441+
}
442+
420443
func configNamesFromList(entries []swarmtypes.Config) []string {
421444
var values []string
422445
for _, entry := range entries {

0 commit comments

Comments
 (0)