Skip to content

Commit

Permalink
go/oasis-test-runner: Fix flaky key manager rotation failure test
Browse files Browse the repository at this point in the history
In the key manager rotation failure test, start key managers at the beginning
of an epoch to ensure that both are added to the committee simultaneously.
If key managers are started randomly, there is a risk that only one will
be added to the committee, as the other may register in another epoch.
  • Loading branch information
peternose committed Nov 17, 2023
1 parent 8d9b3f8 commit 1fc39ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Empty file added .changelog/5455.trivial.md
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ func (sc *kmRotationFailureImpl) Fixture() (*oasis.NetworkFixture, error) {
}

func (sc *kmRotationFailureImpl) Run(ctx context.Context, _ *env.Env) error {
// Start the first two key managers.
// Start the first key manager.
if err := sc.Net.Start(); err != nil {
return err
}

for i := 0; i < 3; i++ {
// Start the third key manager.
// Start the second and the third key manager.
if err := sc.StartKeymanagers([]int{1, 2}); err != nil {
return err
}
Expand Down Expand Up @@ -122,6 +122,11 @@ func (sc *kmRotationFailureImpl) Run(ctx context.Context, _ *env.Env) error {
if err := sc.verifyMasterSecretRejections(ctx, 3); err != nil {
return err
}

// Make sure key managers register in the same epoch.
if err := sc.WaitEpochs(ctx, 1); err != nil {
return err
}
}

// Verify that master secret generation works after the third key manager is deregistered.
Expand Down

0 comments on commit 1fc39ff

Please sign in to comment.