Skip to content

Commit

Permalink
fix cluster tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed Mar 29, 2022
1 parent 3cb260e commit 3846b1d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cmd/util/cmd/epochs/cmd/reset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestReset_LocalSnapshot(t *testing.T) {
unittest.RunWithTempDir(t, func(bootDir string) {

// create a root snapshot
rootSnapshot := unittest.RootSnapshotFixture(unittest.IdentityListFixture(10))
rootSnapshot := unittest.RootSnapshotFixture(unittest.IdentityListFixture(10, unittest.WithAllRoles()))

// write snapshot to correct path in bootDir
err := writeRootSnapshot(bootDir, rootSnapshot)
Expand Down Expand Up @@ -62,7 +62,7 @@ func TestReset_LocalSnapshot(t *testing.T) {
unittest.RunWithTempDir(t, func(bootDir string) {

// create a root snapshot
rootSnapshot := unittest.RootSnapshotFixture(unittest.IdentityListFixture(10))
rootSnapshot := unittest.RootSnapshotFixture(unittest.IdentityListFixture(10, unittest.WithAllRoles()))

// write snapshot to correct path in bootDir
err := writeRootSnapshot(bootDir, rootSnapshot)
Expand Down
4 changes: 2 additions & 2 deletions model/flow/sealing_segment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func (suite *SealingSegmentSuite) TestBuild_MultipleFinalBlockSeals() {
// TestBuild_RootSegment tests we can build a valid root sealing segment.
func (suite *SealingSegmentSuite) TestBuild_RootSegment() {

root, result, seal := unittest.BootstrapFixture(unittest.IdentityListFixture(5))
root, result, seal := unittest.BootstrapFixture(unittest.IdentityListFixture(5, unittest.WithAllRoles()))
suite.sealsByBlockID[root.ID()] = seal
suite.addResult(result)
err := suite.builder.AddBlock(root)
Expand All @@ -277,7 +277,7 @@ func (suite *SealingSegmentSuite) TestBuild_RootSegment() {
// a single-block sealing segment with a block view not equal to 0.
func (suite *SealingSegmentSuite) TestBuild_RootSegmentWrongView() {

root, result, seal := unittest.BootstrapFixture(unittest.IdentityListFixture(5))
root, result, seal := unittest.BootstrapFixture(unittest.IdentityListFixture(5, unittest.WithAllRoles()))
root.Header.View = 10 // invalid root block view
suite.sealsByBlockID[root.ID()] = seal
suite.addResult(result)
Expand Down
5 changes: 0 additions & 5 deletions utils/unittest/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -1035,11 +1035,6 @@ func IdentityListFixture(n int, opts ...func(*flow.Identity)) flow.IdentityList
for i := 0; i < n; i++ {
identity := IdentityFixture()
identity.Address = fmt.Sprintf("%x@flow.com:1234", identity.NodeID)
// ensure to have at least one collection node to create collection cluster
// otherwise, the assignment would have empty cluster
if i%4 == 3 {
identity.Role = flow.RoleCollection
}
for _, opt := range opts {
opt(identity)
}
Expand Down

0 comments on commit 3846b1d

Please sign in to comment.