2018-11-09 09:10:41 -05:00
|
|
|
package context
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
|
2020-02-22 12:12:14 -05:00
|
|
|
"gotest.tools/v3/assert"
|
|
|
|
"gotest.tools/v3/golden"
|
2018-11-09 09:10:41 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestInspect(t *testing.T) {
|
2022-02-25 07:07:16 -05:00
|
|
|
cli := makeFakeCli(t)
|
2018-11-09 09:10:41 -05:00
|
|
|
createTestContextWithKubeAndSwarm(t, cli, "current", "all")
|
|
|
|
cli.OutBuffer().Reset()
|
|
|
|
assert.NilError(t, runInspect(cli, inspectOptions{
|
|
|
|
refs: []string{"current"},
|
|
|
|
}))
|
|
|
|
expected := string(golden.Get(t, "inspect.golden"))
|
2019-04-18 09:12:30 -04:00
|
|
|
si := cli.ContextStore().GetStorageInfo("current")
|
2018-11-09 09:10:41 -05:00
|
|
|
expected = strings.Replace(expected, "<METADATA_PATH>", strings.Replace(si.MetadataPath, `\`, `\\`, -1), 1)
|
|
|
|
expected = strings.Replace(expected, "<TLS_PATH>", strings.Replace(si.TLSPath, `\`, `\\`, -1), 1)
|
|
|
|
assert.Equal(t, cli.OutBuffer().String(), expected)
|
|
|
|
}
|