github.com/xeptore/docker-cli@v20.10.14+incompatible/cli/command/context/inspect_test.go (about)

     1  package context
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  
     7  	"gotest.tools/v3/assert"
     8  	"gotest.tools/v3/golden"
     9  )
    10  
    11  func TestInspect(t *testing.T) {
    12  	cli, cleanup := makeFakeCli(t)
    13  	defer cleanup()
    14  	createTestContextWithKubeAndSwarm(t, cli, "current", "all")
    15  	cli.OutBuffer().Reset()
    16  	assert.NilError(t, runInspect(cli, inspectOptions{
    17  		refs: []string{"current"},
    18  	}))
    19  	expected := string(golden.Get(t, "inspect.golden"))
    20  	si := cli.ContextStore().GetStorageInfo("current")
    21  	expected = strings.Replace(expected, "<METADATA_PATH>", strings.Replace(si.MetadataPath, `\`, `\\`, -1), 1)
    22  	expected = strings.Replace(expected, "<TLS_PATH>", strings.Replace(si.TLSPath, `\`, `\\`, -1), 1)
    23  	assert.Equal(t, cli.OutBuffer().String(), expected)
    24  }