Skip to content

Commit

Permalink
help1
Browse files Browse the repository at this point in the history
  • Loading branch information
Lazar955 committed Sep 17, 2024
1 parent c588cc3 commit cc084c7
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions e2etest/test_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/btcsuite/btcd/txscript"
"go.uber.org/zap"
"os"
"os/exec"
"path/filepath"
"testing"
"time"
Expand Down Expand Up @@ -131,7 +132,7 @@ func StartManager(t *testing.T, numMatureOutputsInWallet uint32, epochInterval u

// start Babylon node

tmpDir, err := tempDir()
tmpDir, err := tempDir(t)
require.NoError(t, err)

babylond, err := manager.RunBabylondResource(t, tmpDir, baseHeaderHex, hex.EncodeToString(pkScript), epochInterval)
Expand All @@ -142,10 +143,22 @@ func StartManager(t *testing.T, numMatureOutputsInWallet uint32, epochInterval u
cfg.Babylon.Key = "test-spending-key" // keyring to bbn node
cfg.Babylon.GasAdjustment = 3.0

fmt.Printf("PATH ----- %s \n", cfg.Babylon.KeyDirectory)
fmt.Printf("%+v\n", cfg.Babylon)

// update port with the dynamically allocated one from docker
cfg.Babylon.RPCAddr = fmt.Sprintf("http://localhost:%s", babylond.GetPort("26657/tcp"))
cfg.Babylon.GRPCAddr = fmt.Sprintf("https://localhost:%s", babylond.GetPort("9090/tcp"))

cmd := exec.Command("ls", fmt.Sprintf("-a %s", cfg.Babylon.KeyDirectory))

// Get the output of the command
output, err := cmd.Output()
require.NoError(t, err)

// Print the output
fmt.Printf("-------- %s", string(output))

babylonClient, err := bbnclient.New(&cfg.Babylon, nil)
require.NoError(t, err)

Expand Down Expand Up @@ -275,15 +288,16 @@ func importPrivateKey(btcHandler *BitcoindTestHandler) (*btcec.PrivateKey, error
return privKey, nil
}

func tempDir() (string, error) {
tempName, err := os.MkdirTemp(os.TempDir(), "BabylonTestVigilante")
if err != nil {
return "", err
}
func tempDir(t *testing.T) (string, error) {
tempPath, err := os.MkdirTemp(os.TempDir(), "babylon-test-*")

Check failure on line 292 in e2etest/test_manager.go

View workflow job for this annotation

GitHub Actions / lint_test / lint

ineffectual assignment to err (ineffassign)

if err = os.Chmod(tempName, 0755); err != nil {
if err = os.Chmod(tempPath, 0777); err != nil {
return "", err
}

return tempName, nil
t.Cleanup(func() {
_ = os.RemoveAll(tempPath)
})

return tempPath, err
}

0 comments on commit cc084c7

Please sign in to comment.