Run integration tests against the dstask binary produced in the build step diff --git a/integration/main_test.go b/integration/main_test.go index 9464ba0..05539a5 100644 --- a/integration/main_test.go +++ b/integration/main_test.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "io/ioutil" - "log" "os" "os/exec" "testing" @@ -13,34 +12,12 @@ import ( "gotest.tools/assert" ) -func TestMain(m *testing.M) { - if err := compile(); err != nil { - log.Fatalf("compile error: %v", err) - } - cleanup := func() { - if err := os.Remove("dstask"); err != nil { - log.Panic("could not remove integration test binary") - } - } - - exitCode := m.Run() - cleanup() - os.Exit(exitCode) -} - -func compile() error { - // We expect to execute in the ./integration directory, and we will output - // our test binary there. - cmd := exec.Command("go", "build", "-mod=vendor", "-o", "./dstask", "../cmd/dstask/main.go") - return cmd.Run() -} - // Create a callable closure that will run our test binary against a // particular repository path. Any variables set in the environment will be // passed to the test subprocess. func testCmd(repoPath string) func(args ...string) ([]byte, *exec.ExitError, bool) { return func(args ...string) ([]byte, *exec.ExitError, bool) { - cmd := exec.Command("./dstask", args...) + cmd := exec.Command("../bin/dstask", args...) env := os.Environ() cmd.Env = append(env, fmt.Sprintf("DSTASK_GIT_REPO=%s", repoPath)) output, err := cmd.Output()