Skip to content

Commit 8d809aa

Browse files
authored
fix(tests): TestAuthorModule_HasSessionKeys_Integration (#2932)
- Fix test occasionally failing due to data race
1 parent ec2549a commit 8d809aa

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

dot/rpc/modules/author_integration_test.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,6 @@ func TestAuthorModule_HasKey_Integration(t *testing.T) {
449449

450450
func TestAuthorModule_HasSessionKeys_Integration(t *testing.T) {
451451
t.Parallel()
452-
integrationTestController := setupStateAndRuntime(t, t.TempDir(), useInstanceFromGenesis)
453-
auth := newAuthorModule(t, integrationTestController)
454452

455453
const granSeed = "0xf25586ceb64a043d887631fa08c2ed790ef7ae3c7f28de5172005f8b9469e529"
456454
const granPubK = "0x6b802349d948444d41397da09ec597fbd8ae8fdd3dfa153b2bb2bddcf020457c"
@@ -474,17 +472,6 @@ func TestAuthorModule_HasSessionKeys_Integration(t *testing.T) {
474472
},
475473
}
476474

477-
for _, toInsert := range insertSessionKeys {
478-
for _, keytype := range toInsert.ktype {
479-
err := auth.InsertKey(nil, &KeyInsertRequest{
480-
Type: keytype,
481-
Seed: toInsert.seed,
482-
PublicKey: toInsert.pubk,
483-
}, nil)
484-
require.NoError(t, err)
485-
}
486-
}
487-
488475
testcases := map[string]struct {
489476
pubSessionKeys string
490477
expect bool
@@ -527,6 +514,20 @@ func TestAuthorModule_HasSessionKeys_Integration(t *testing.T) {
527514
tt := tt
528515
t.Run(tname, func(t *testing.T) {
529516
t.Parallel()
517+
518+
integrationTestController := setupStateAndRuntime(t, t.TempDir(), useInstanceFromGenesis)
519+
auth := newAuthorModule(t, integrationTestController)
520+
for _, toInsert := range insertSessionKeys {
521+
for _, keytype := range toInsert.ktype {
522+
err := auth.InsertKey(nil, &KeyInsertRequest{
523+
Type: keytype,
524+
Seed: toInsert.seed,
525+
PublicKey: toInsert.pubk,
526+
}, nil)
527+
require.NoError(t, err)
528+
}
529+
}
530+
530531
req := HasSessionKeyRequest{
531532
PublicKeys: tt.pubSessionKeys,
532533
}

0 commit comments

Comments
 (0)