Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ineiti committed Feb 29, 2024
1 parent c27f860 commit f368cf3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Set up Go ^1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: ^1.19
go-version: '1.20'

- name: Check out code into the Go module directory
uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/go_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
env:
LLVL: trace
steps:
- name: Set up Go ^1.19
- name: Set up Go '1.20'
uses: actions/setup-go@v3
with:
go-version: ^1.19
go-version: '1.20'

- name: Check out code into the Go module directory
uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestRegisterContract(t *testing.T) {
}

func TestNewTransaction(t *testing.T) {
mgr := NewManager(signed.NewManager(fake.NewSigner(), nil))
mgr := NewManager(signed.NewManager(fake.NewSigner(), fake.NewClient()))

tx, err := mgr.Make(authority.New(nil, nil))
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion core/txn/signed/signed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func TestTransactionFactory_Deserialize(t *testing.T) {
}

func TestManager_Make(t *testing.T) {
mgr := NewManager(fake.NewSigner(), nil)
mgr := NewManager(fake.NewSigner(), fake.NewClient())

tx, err := mgr.Make(txn.Arg{Key: "a", Value: []byte{1, 2, 3}})
require.NoError(t, err)
Expand Down
14 changes: 14 additions & 0 deletions testing/fake/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package fake
import (
"hash"

"go.dedis.ch/dela/core/access"
"go.dedis.ch/dela/crypto"
"go.dedis.ch/dela/serde"
)
Expand Down Expand Up @@ -253,6 +254,19 @@ func (s Signer) Aggregate(...crypto.Signature) (crypto.Signature, error) {
return Signature{}, s.err
}

type Client struct {
nonce uint64
}

// NewClient returns a fake client
func NewClient() Client {
return Client{}
}

func (c Client) GetNonce(access.Identity) (uint64, error) {
return c.nonce, nil
}

// Verifier is a fake implementation of crypto.Verifier.
//
// - implements crypto.Verifier
Expand Down

0 comments on commit f368cf3

Please sign in to comment.