Skip to content

Commit

Permalink
rely on testing temp dir for testing files
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyzags committed Jan 27, 2025
1 parent 6cf947b commit 6386078
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/relayer/relayminer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"net"
"net/http"
"os"
"path/filepath"
"testing"
"time"

Expand Down Expand Up @@ -102,16 +102,15 @@ func TestRelayMiner_Ping(t *testing.T) {

time.Sleep(time.Millisecond)

filename := "/tmp/relayerminer.ping.sock"
relayminerSocketPath := filepath.Join(t.TempDir(), "relayerminer.ping.sock")

relayminer.ServePing(ctx, "unix", filename)
defer os.Remove(filename)
relayminer.ServePing(ctx, "unix", relayminerSocketPath)

time.Sleep(time.Millisecond)

transport := &http.Transport{
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
return net.Dial("unix", "/tmp/relayerminer.ping.sock")
return net.Dial("unix", relayminerSocketPath)
},
}

Expand Down

0 comments on commit 6386078

Please sign in to comment.