Skip to content

Commit

Permalink
Fix test error.
Browse files Browse the repository at this point in the history
  • Loading branch information
winder committed Apr 21, 2022
1 parent 4b7337b commit 303231f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/algod/main_test.go
Expand Up @@ -29,21 +29,22 @@ import (
)

func BenchmarkAlgodStartup(b *testing.B) {
var args algodArgs
tmpDir, err := ioutil.TempDir(os.TempDir(), "BenchmarkAlgodStartup")
require.NoError(b, err)
defer os.RemoveAll(tmpDir)
genesisFile, err := ioutil.ReadFile("../../installer/genesis/devnet/genesis.json")
require.NoError(b, err)

dataDirectory = &tmpDir
args.dataDirectory = tmpDir
bInitAndExit := true
initAndExit = &bInitAndExit
args.initAndExit = bInitAndExit
b.StartTimer()
for n := 0; n < b.N; n++ {
err := ioutil.WriteFile(filepath.Join(tmpDir, config.GenesisJSONFile), genesisFile, 0766)
require.NoError(b, err)
fmt.Printf("file %s was written\n", filepath.Join(tmpDir, config.GenesisJSONFile))
run()
run(args)
os.RemoveAll(tmpDir)
os.Mkdir(tmpDir, 0766)
}
Expand Down

0 comments on commit 303231f

Please sign in to comment.