mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add test for keeping same daemon ID on upgrade
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
53dad9f027
commit
f923321aae
2 changed files with 25 additions and 0 deletions
|
@ -63,6 +63,8 @@ var flatOptions = map[string]bool{
|
||||||
var skipValidateOptions = map[string]bool{
|
var skipValidateOptions = map[string]bool{
|
||||||
"features": true,
|
"features": true,
|
||||||
"builder": true,
|
"builder": true,
|
||||||
|
// Corresponding flag has been removed because it was already unusable
|
||||||
|
"deprecated-key-path": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
// skipDuplicates contains configuration keys that
|
// skipDuplicates contains configuration keys that
|
||||||
|
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"io/ioutil"
|
||||||
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
@ -13,6 +15,7 @@ import (
|
||||||
swarmtypes "github.com/docker/docker/api/types/swarm"
|
swarmtypes "github.com/docker/docker/api/types/swarm"
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
"github.com/docker/docker/integration/internal/swarm"
|
"github.com/docker/docker/integration/internal/swarm"
|
||||||
|
"github.com/docker/docker/internal/test/daemon"
|
||||||
"github.com/docker/docker/pkg/stdcopy"
|
"github.com/docker/docker/pkg/stdcopy"
|
||||||
"gotest.tools/assert"
|
"gotest.tools/assert"
|
||||||
is "gotest.tools/assert/cmp"
|
is "gotest.tools/assert/cmp"
|
||||||
|
@ -417,6 +420,26 @@ func TestConfigCreateResolve(t *testing.T) {
|
||||||
assert.Assert(t, is.Equal(0, len(entries)))
|
assert.Assert(t, is.Equal(0, len(entries)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestConfigDaemonLibtrustID(t *testing.T) {
|
||||||
|
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
|
||||||
|
defer setupTest(t)()
|
||||||
|
|
||||||
|
d := daemon.New(t)
|
||||||
|
defer d.Stop(t)
|
||||||
|
|
||||||
|
trustKey := filepath.Join(d.RootDir(), "key.json")
|
||||||
|
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)
|
||||||
|
assert.NilError(t, err)
|
||||||
|
|
||||||
|
config := filepath.Join(d.RootDir(), "daemon.json")
|
||||||
|
err = ioutil.WriteFile(config, []byte(`{"deprecated-key-path": "`+trustKey+`"}`), 0644)
|
||||||
|
assert.NilError(t, err)
|
||||||
|
|
||||||
|
d.Start(t, "--config-file", config)
|
||||||
|
info := d.Info(t)
|
||||||
|
assert.Equal(t, info.ID, "WTJ3:YSIP:CE2E:G6KJ:PSBD:YX2Y:WEYD:M64G:NU2V:XPZV:H2CR:VLUB")
|
||||||
|
}
|
||||||
|
|
||||||
func configNamesFromList(entries []swarmtypes.Config) []string {
|
func configNamesFromList(entries []swarmtypes.Config) []string {
|
||||||
var values []string
|
var values []string
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
|
|
Loading…
Add table
Reference in a new issue