From 1fc39ff429e373bf801a773accc88eafb1ce7f34 Mon Sep 17 00:00:00 2001 From: Peter Nose Date: Fri, 17 Nov 2023 19:45:02 +0100 Subject: [PATCH] go/oasis-test-runner: Fix flaky key manager rotation failure test 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. --- .changelog/5455.trivial.md | 0 .../scenario/e2e/runtime/keymanager_rotation_failure.go | 9 +++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changelog/5455.trivial.md diff --git a/.changelog/5455.trivial.md b/.changelog/5455.trivial.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_rotation_failure.go b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_rotation_failure.go index 4490875503a..95e44fcc95c 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_rotation_failure.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_rotation_failure.go @@ -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 } @@ -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.