Skip to content

Commit

Permalink
Put hook type detection test binaries in the temp dir
Browse files Browse the repository at this point in the history
  • Loading branch information
moskyb committed May 19, 2023
1 parent 1a5f050 commit 251b72f
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions hook/type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,9 @@ func TestHookType(t *testing.T) {
for _, arch := range []string{"amd64", "arm64"} {

binaryName := fmt.Sprintf("test-binary-%s-%s", operatingSystem, arch)
binaryPath := hookFixture(root, binaryName)
binaryPath := filepath.Join(os.TempDir(), binaryName)
sourcePath := hookFixture(root)

fmt.Println(binaryPath)

cmd := exec.Command("go", "build", "-o", binaryPath, sourcePath)
extraEnv := []string{
fmt.Sprintf("GOOS=%s", operatingSystem),
Expand All @@ -87,18 +85,10 @@ func TestHookType(t *testing.T) {
cmd.Env = append(os.Environ(), extraEnv...)

output, err := cmd.CombinedOutput()
fmt.Println(string(output))
if err != nil {
t.Fatalf("Failed to build test-binary-hook: %v, output: %s", err, string(output))
}

t.Cleanup(func() {
err = os.Remove(binaryPath)
if err != nil {
t.Fatalf("Failed to remove test-binary-hook: %v", err)
}
})

cases = append(cases, testCase{
name: fmt.Sprintf("binary for %s/%s", operatingSystem, arch),
hookPath: binaryPath,
Expand Down

0 comments on commit 251b72f

Please sign in to comment.