You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
993 B
Go
41 lines
993 B
Go
package tests
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/moby/buildkit/util/testutil/integration"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func inspectCmd(sb integration.Sandbox, opts ...cmdOpt) (string, error) {
|
|
opts = append([]cmdOpt{withArgs("inspect")}, opts...)
|
|
cmd := buildxCmd(sb, opts...)
|
|
out, err := cmd.CombinedOutput()
|
|
return string(out), err
|
|
}
|
|
|
|
var inspectTests = []func(t *testing.T, sb integration.Sandbox){
|
|
testInspect,
|
|
}
|
|
|
|
func testInspect(t *testing.T, sb integration.Sandbox) {
|
|
out, err := inspectCmd(sb)
|
|
require.NoError(t, err, string(out))
|
|
|
|
var name string
|
|
var driver string
|
|
for _, line := range strings.Split(out, "\n") {
|
|
if v, ok := strings.CutPrefix(line, "Name:"); ok && name == "" {
|
|
name = strings.TrimSpace(v)
|
|
}
|
|
if v, ok := strings.CutPrefix(line, "Driver:"); ok && driver == "" {
|
|
driver = strings.TrimSpace(v)
|
|
}
|
|
}
|
|
|
|
require.Equal(t, sb.Address(), name)
|
|
sbDriver, _, _ := strings.Cut(sb.Name(), "+")
|
|
require.Equal(t, sbDriver, driver)
|
|
}
|