github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/cmd/bootstrap/utils/unittest.go (about) 1 package utils 2 3 import ( 4 "os" 5 "testing" 6 7 "github.com/stretchr/testify/require" 8 9 "github.com/onflow/flow-go/utils/unittest" 10 ) 11 12 func RunWithSporkBootstrapDir(t testing.TB, f func(bootDir, partnerDir, partnerWeights, internalPrivDir, configPath string)) { 13 dir := unittest.TempDir(t) 14 defer os.RemoveAll(dir) 15 16 // make sure constraints are satisfied, 2/3's of con and col nodes are internal 17 internalNodes := GenerateNodeInfos(3, 6, 2, 1, 1) 18 partnerNodes := GenerateNodeInfos(1, 1, 1, 1, 1) 19 20 partnerDir, partnerWeightsPath, err := WritePartnerFiles(partnerNodes, dir) 21 require.NoError(t, err) 22 23 internalPrivDir, configPath, err := WriteInternalFiles(internalNodes, dir) 24 require.NoError(t, err) 25 26 f(dir, partnerDir, partnerWeightsPath, internalPrivDir, configPath) 27 }