Skip to content

Commit

Permalink
Skip test if on osx
Browse files Browse the repository at this point in the history
Remove unneeded reliance on testutil for running simple commands as that package's init mechanism tries to communicate with Docker
  • Loading branch information
matthewmcneely committed Jan 10, 2025
1 parent 837e334 commit 7180543
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions protos/protos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,29 @@
package protos

import (
"fmt"
"os/exec"
"path/filepath"
"runtime"
"testing"

"github.com/stretchr/testify/require"

"github.com/hypermodeinc/dgraph/v24/testutil"
)

func TestProtosRegenerate(t *testing.T) {
err := testutil.Exec("make", "regenerate")
require.NoError(t, err, "Got error while regenerating protos: %v\n", err)
if runtime.GOOS != "linux" {
t.Skip("Skipping test on non-Linux platform")
}

// Run make regenerate
cmd := exec.Command("make", "regenerate")
output, err := cmd.CombinedOutput()
require.NoError(t, err, "Got error while regenerating protos: %s", output)

// Check if generated files changed
generatedProtos := filepath.Join("pb", "pb.pb.go")
err = testutil.Exec("git", "diff", "--quiet", "--", generatedProtos)
diffCmd := exec.Command("git", "diff", "--quiet", "--", generatedProtos)
fmt.Printf("diffCmd: %+v\n", diffCmd)
err = diffCmd.Run()
require.NoError(t, err, "pb.pb.go changed after regenerating")
}

0 comments on commit 7180543

Please sign in to comment.