Skip to content

Commit

Permalink
Fix flaky test - TestConvertBlockWithBadSignature (#711)
Browse files Browse the repository at this point in the history
* Test err

* lint

* Always using a broken sig

* missed bad sign
  • Loading branch information
otherview authored Apr 23, 2024
1 parent c71750f commit d847c46
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions api/subscriptions/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package subscriptions

import (
"crypto/rand"
"bytes"
"math/big"
"testing"

Expand All @@ -25,12 +25,11 @@ import (

func TestConvertBlockWithBadSignature(t *testing.T) {
// Arrange
var sig [65]byte
rand.Read(sig[:])
badSig := bytes.Repeat([]byte{0xf}, 65)

b := new(block.Builder).
Build().
WithSignature(sig[:])
WithSignature(badSig[:])

extendedBlock := &chain.ExtendedBlock{Block: b, Obsolete: false}

Expand Down Expand Up @@ -146,8 +145,7 @@ func TestConvertTransfer(t *testing.T) {

func TestConvertEventWithBadSignature(t *testing.T) {
// Arrange
var sig [65]byte
rand.Read(sig[:])
badSig := bytes.Repeat([]byte{0xf}, 65)

// New tx
transaction := new(tx.Builder).
Expand All @@ -158,7 +156,7 @@ func TestConvertEventWithBadSignature(t *testing.T) {
Nonce(1).
BlockRef(tx.NewBlockRef(0)).
Build().
WithSignature(sig[:])
WithSignature(badSig[:])

// New block
blk := new(block.Builder).
Expand Down

0 comments on commit d847c46

Please sign in to comment.