Some checks failed
CodeQL / Analyze (push) Waiting to run
Docker Build & Push Simapp (main) / docker-build (push) Waiting to run
golangci-lint / lint (push) Waiting to run
Tests / Code Coverage / build (amd64) (push) Waiting to run
Tests / Code Coverage / build (arm64) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[additional-args:-tags="test_e2e" name:e2e path:./e2e]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:08-wasm path:./modules/light-clients/08-wasm]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:ibc-go path:.]) (push) Waiting to run
Deploy to GitHub Pages / Deploy to GitHub Pages (push) Has been cancelled
Buf-Push / push (push) Has been cancelled
37 lines
788 B
Go
37 lines
788 B
Go
package directories
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path"
|
|
"strings"
|
|
)
|
|
|
|
const (
|
|
e2eDir = "e2e"
|
|
|
|
// DefaultGenesisExportPath is the default path to which Genesis debug files will be exported to.
|
|
DefaultGenesisExportPath = "diagnostics/genesis.json"
|
|
)
|
|
|
|
// E2E finds the e2e directory above the test.
|
|
func E2E() (string, error) {
|
|
wd, err := os.Getwd()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
const maxAttempts = 100
|
|
count := 0
|
|
for ; !strings.HasSuffix(wd, e2eDir) && count < maxAttempts; wd = path.Dir(wd) {
|
|
count++
|
|
}
|
|
|
|
// arbitrary value to avoid getting stuck in an infinite loop if this is called
|
|
// in a context where the e2e directory does not exist.
|
|
if count == maxAttempts {
|
|
return "", fmt.Errorf("unable to find e2e directory after %d tries", maxAttempts)
|
|
}
|
|
|
|
return wd, nil
|
|
}
|