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+
420443func configNamesFromList (entries []swarmtypes.Config ) []string {
421444 var values []string
422445 for _ , entry := range entries {
0 commit comments