Run integration tests against the dstask binary produced in the build step. --- a/integration/main_test.go +++ b/integration/main_test.go @@ -6,46 +6,14 @@ import ( "log" "os" "os/exec" - "runtime" "testing" "github.com/naggie/dstask" "gotest.tools/assert" ) -func TestMain(m *testing.M) { - binary := binaryPath() - - if err := compile(binary); err != nil { - log.Fatalf("compile error: %v", err) - } - - cleanup := func() { - if err := os.Remove(binary); err != nil { - log.Panicf("could not remove integration test binary %s", binary) - } - } - - exitCode := m.Run() - - cleanup() - os.Exit(exitCode) -} - -func compile(outputPath string) 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", outputPath, "../cmd/dstask/main.go") - - return cmd.Run() -} - func binaryPath() string { - if runtime.GOOS == "windows" { - return "./dstask.exe" - } - - return "./dstask" + return "../bin/dstask" } // Create a callable closure that will run our test binary against a