Skip to content

Commit

Permalink
make test wait for both goroutines
Browse files Browse the repository at this point in the history
  • Loading branch information
y0sher committed Oct 27, 2024
1 parent 95aeb43 commit 0678236
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions signer/sign_attestation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,35 @@ func TestLockSameValidatorInParallel(t *testing.T) {
attData := &phase0.AttestationData{}
require.NoError(t, attData.UnmarshalSSZ(attestationDataByts))

ch := make(chan struct{})

go func() {
_, _, err := signer.SignBeaconAttestation(attData, phase0.Domain{0}, pk)
require.NoError(t, err)

close(ch)
}()

ch := make(chan struct{})
ch2 := make(chan struct{})

go func() {
_, _, err := signer.SignBeaconAttestation(attData, domain, pk)
close(ch)
require.NoError(t, err)
close(ch2)

}()

select {
case <-ch2:
case <-time.After(200 * time.Millisecond):
t.Fatal("timeout")
}

select {
case <-ch:
case <-time.After(200 * time.Millisecond):
t.Fatal("timeout")
}

}

func TestAttestationSlashingSignatures(t *testing.T) {
Expand Down

0 comments on commit 0678236

Please sign in to comment.