Skip to content

Commit

Permalink
PR feedback (#4300)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Bellamy authored Mar 22, 2022
1 parent 7df8601 commit e2a78e0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
6 changes: 4 additions & 2 deletions ingest/ledgerbackend/captive_core_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ type testLedgerHeader struct {
}

func TestCaptiveNew(t *testing.T) {
storagePath, err := os.MkdirTemp(os.TempDir(), "captive-core-*")
storagePath, err := os.MkdirTemp("", "captive-core-*")
require.NoError(t, err)
defer os.RemoveAll(storagePath)

executablePath := "/etc/stellar-core"
networkPassphrase := network.PublicNetworkPassphrase
Expand Down Expand Up @@ -827,8 +828,9 @@ func TestCaptiveGetLedger_NextLedger0RangeFromIsSmallerThanLedgerFromBuffer(t *t
}

func TestCaptiveStellarCore_PrepareRangeAfterClose(t *testing.T) {
storagePath, err := os.MkdirTemp(os.TempDir(), "captive-core-*")
storagePath, err := os.MkdirTemp("", "captive-core-*")
require.NoError(t, err)
defer os.RemoveAll(storagePath)

ctx := context.Background()
executablePath := "/etc/stellar-core"
Expand Down
6 changes: 4 additions & 2 deletions ingest/ledgerbackend/file_watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ func (m *mockHash) hashFile(fp string) (hash, error) {
}

func createFWFixtures(t *testing.T) (*mockHash, *stellarCoreRunner, *fileWatcher) {
storagePath, err := os.MkdirTemp(os.TempDir(), "captive-core-*")
storagePath, err := os.MkdirTemp("", "captive-core-*")
require.NoError(t, err)
defer os.RemoveAll(storagePath)

ms := &mockHash{
hashResult: hash{},
Expand Down Expand Up @@ -75,8 +76,9 @@ func createFWFixtures(t *testing.T) (*mockHash, *stellarCoreRunner, *fileWatcher
}

func TestNewFileWatcherError(t *testing.T) {
storagePath, err := os.MkdirTemp(os.TempDir(), "captive-core-*")
storagePath, err := os.MkdirTemp("", "captive-core-*")
require.NoError(t, err)
defer os.RemoveAll(storagePath)

ms := &mockHash{
hashResult: hash{},
Expand Down
9 changes: 6 additions & 3 deletions ingest/ledgerbackend/stellar_core_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import (
)

func TestCloseBeforeStartOffline(t *testing.T) {
storagePath, err := os.MkdirTemp(os.TempDir(), "captive-core-*")
storagePath, err := os.MkdirTemp("", "captive-core-*")
require.NoError(t, err)
defer os.RemoveAll(storagePath)

captiveCoreToml, err := NewCaptiveCoreToml(CaptiveCoreTomlParams{})
assert.NoError(t, err)
Expand Down Expand Up @@ -42,8 +43,9 @@ func TestCloseBeforeStartOffline(t *testing.T) {
}

func TestCloseBeforeStartOnline(t *testing.T) {
storagePath, err := os.MkdirTemp(os.TempDir(), "captive-core-*")
storagePath, err := os.MkdirTemp("", "captive-core-*")
require.NoError(t, err)
defer os.RemoveAll(storagePath)

captiveCoreToml, err := NewCaptiveCoreToml(CaptiveCoreTomlParams{})
assert.NoError(t, err)
Expand Down Expand Up @@ -72,8 +74,9 @@ func TestCloseBeforeStartOnline(t *testing.T) {
}

func TestCloseBeforeStartOnlineWithError(t *testing.T) {
storagePath, err := os.MkdirTemp(os.TempDir(), "captive-core-*")
storagePath, err := os.MkdirTemp("", "captive-core-*")
require.NoError(t, err)
defer os.RemoveAll(storagePath)

captiveCoreToml, err := NewCaptiveCoreToml(CaptiveCoreTomlParams{})
assert.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/integration/parameters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func createCaptiveCoreConfig(contents string) (string, string, func()) {
panic(err)
}

storagePath, err := ioutil.TempDir("", "captive-core-test-*-storage")
storagePath, err := os.MkdirTemp("", "captive-core-test-*-storage")
if err != nil {
panic(err)
}
Expand Down

0 comments on commit e2a78e0

Please sign in to comment.