Skip to content

Commit

Permalink
add chore use os.MkdirTemp + t.Cleanup fix (from PR#4037)
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardmack committed Jun 12, 2024
1 parent 2371b66 commit 1b3436e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ jobs:
run: make compile-erasure

- name: Run integration tests
run: go test -timeout=45m -tags integration ${{ matrix.packages }}
run: CI=buildjet go test -timeout=45m -tags integration ${{ matrix.packages }}
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
run: make compile-erasure

- name: Run unit tests
run: go test -coverprofile=coverage.out -covermode=atomic -timeout=45m ./...
run: CI=buildjet go test -coverprofile=coverage.out -covermode=atomic -timeout=45m ./...

- name: Trie memory test
run: |
Expand Down
9 changes: 9 additions & 0 deletions dot/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ import (

func DefaultTestWestendDevConfig(t *testing.T) *cfg.Config {
config := westenddev.DefaultConfig()

config.BasePath = t.TempDir()
if os.Getenv("CI") == "buildjet" {
tmpdir, err := os.MkdirTemp("..", "*_wnd_dev_cfg")
require.NoError(t, err)
t.Cleanup(func() {
require.NoError(t, os.RemoveAll(tmpdir))
})
config.BasePath = tmpdir
}

return config
}
Expand Down
8 changes: 8 additions & 0 deletions dot/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ import (
// NewTestGenesisRawFile returns a test genesis file using "westend-dev" raw data
func NewTestGenesisRawFile(t *testing.T, config *cfg.Config) (filename string) {
filename = filepath.Join(t.TempDir(), "genesis.json")
if os.Getenv("CI") == "buildjet" {
tmpdir, err := os.MkdirTemp("..", "*_gen_raw_file")
require.NoError(t, err)
t.Cleanup(func() {
require.NoError(t, os.RemoveAll(tmpdir))
})
filename = filepath.Join(tmpdir, "genesis.json")
}

fp := utils.GetWestendDevRawGenesisPath(t)

Expand Down

0 comments on commit 1b3436e

Please sign in to comment.