Skip to content

Commit

Permalink
Changes: log_test.go - whiteboxed, handshake_test.go - removed commen…
Browse files Browse the repository at this point in the history
…ted test
  • Loading branch information
ayuryshev committed Jun 4, 2019
1 parent af6f71d commit c035c01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 30 deletions.
24 changes: 0 additions & 24 deletions pkg/transport/handshake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,30 +199,6 @@ func TestSettlementHandshake(t *testing.T) {

}

/*
func TestSettlementHandshakeInvalidSig(t *testing.T) {
mockEnv := newHsMockEnv()
require.NoError(t, mockEnv.err1)
require.NoError(t, mockEnv.err2)
go settlementInitiatorHandshake(true)(mockEnv.m2, mockEnv.tr1) // nolint: errcheck
_, err := settlementResponderHandshake(mockEnv.m2, mockEnv.tr2)
require.Error(t, err)
assert.Equal(t, "Recovered pubkey does not match pubkey", err.Error())
in, out := net.Pipe()
tr1 := NewMockTransport(in, mockEnv.pk1, mockEnv.pk2)
tr2 := NewMockTransport(out, mockEnv.pk2, mockEnv.pk1)
go settlementResponderHandshake(mockEnv.m1, tr2) // nolint: errcheck
_, err = settlementInitiatorHandshake(true)(mockEnv.m1, tr1)
require.Error(t, err)
assert.Equal(t, "Recovered pubkey does not match pubkey", err.Error())
}
*/

func TestSettlementHandshakePrivate(t *testing.T) {
mockEnv := newHsMockEnv()

Expand Down
13 changes: 7 additions & 6 deletions pkg/transport/log_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package transport
package transport_test

import (
"io/ioutil"
Expand All @@ -7,17 +7,18 @@ import (
"testing"

"github.com/google/uuid"
"github.com/skycoin/skywire/pkg/transport"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func testTransportLogStore(t *testing.T, logStore LogStore) {
func testTransportLogStore(t *testing.T, logStore transport.LogStore) {
t.Helper()

id1 := uuid.New()
entry1 := &LogEntry{big.NewInt(100), big.NewInt(200)}
entry1 := &transport.LogEntry{big.NewInt(100), big.NewInt(200)}
id2 := uuid.New()
entry2 := &LogEntry{big.NewInt(300), big.NewInt(400)}
entry2 := &transport.LogEntry{big.NewInt(300), big.NewInt(400)}

require.NoError(t, logStore.Record(id1, entry1))
require.NoError(t, logStore.Record(id2, entry2))
Expand All @@ -29,15 +30,15 @@ func testTransportLogStore(t *testing.T, logStore LogStore) {
}

func TestInMemoryTransportLogStore(t *testing.T) {
testTransportLogStore(t, InMemoryTransportLogStore())
testTransportLogStore(t, transport.InMemoryTransportLogStore())
}

func TestFileTransportLogStore(t *testing.T) {
dir, err := ioutil.TempDir("", "log_store")
require.NoError(t, err)
defer os.RemoveAll(dir)

ls, err := FileTransportLogStore(dir)
ls, err := transport.FileTransportLogStore(dir)
require.NoError(t, err)
testTransportLogStore(t, ls)
}

0 comments on commit c035c01

Please sign in to comment.