mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
test: add basic integration tests
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
30
tests/integration.go
Normal file
30
tests/integration.go
Normal file
@ -0,0 +1,30 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"testing"
|
||||
|
||||
"github.com/containerd/continuity/fs/fstest"
|
||||
"github.com/moby/buildkit/util/testutil/integration"
|
||||
)
|
||||
|
||||
func tmpdir(t *testing.T, appliers ...fstest.Applier) (string, error) {
|
||||
tmpdir := t.TempDir()
|
||||
if err := fstest.Apply(appliers...).Apply(tmpdir); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return tmpdir, nil
|
||||
}
|
||||
|
||||
func buildxCmd(sb integration.Sandbox, args ...string) *exec.Cmd {
|
||||
if builder := sb.Address(); builder != "" {
|
||||
args = append([]string{"--builder=" + builder}, args...)
|
||||
}
|
||||
cmd := exec.Command("buildx", args...)
|
||||
if context := sb.DockerAddress(); context != "" {
|
||||
cmd.Env = append(os.Environ(), "DOCKER_CONTEXT="+context)
|
||||
}
|
||||
|
||||
return cmd
|
||||
}
|
Reference in New Issue
Block a user