Skip to content

Commit

Permalink
fix integration tests ref fibercrypto#165
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvaro Denis committed Mar 3, 2020
1 parent 46ffeb7 commit 6484cf9
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 33 deletions.
16 changes: 13 additions & 3 deletions src/cli/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"path/filepath"
"runtime"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -532,7 +533,10 @@ func TestRecovery(t *testing.T) {
var fail = false
var stdInDone = false

wg := sync.WaitGroup{}
go func() {
wg.Add(1)
defer wg.Done()
scanner := bufio.NewScanner(stdoutPipe)

scanner.Split(bufio.ScanWords)
Expand All @@ -545,7 +549,7 @@ func TestRecovery(t *testing.T) {

stdInDone = true
} else if stdInDone {
if m == "Wrong" || m == "Word" {
if m == "Wrong" || m == "word" {
fail = true
break
}
Expand All @@ -554,14 +558,20 @@ func TestRecovery(t *testing.T) {
}()

go func() {
wg.Add(1)
defer wg.Done()
scanner := bufio.NewScanner(stderrPipe)
scanner.Split(bufio.ScanWords)
for scanner.Scan() {
log.Errorln(scanner.Text())
m := scanner.Text()
if m == "Wrong" || m == "word" || m == `error="Word` {
fail = true
break
}
}
}()

err = cmd.Wait()
wg.Wait()
require.NoError(t, err)
require.True(t, fail)
}
Expand Down
114 changes: 85 additions & 29 deletions src/skywallet/mock_devicer_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/skywallet/skywallet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (suite *devicerSuit) TestFirmwareUpload() {

for _, tc := range tt {
driverMock.On("DeviceType").Return(tc.deviceType)
err := device.FirmwareUpload([]byte{}, [32]byte{})
_, err := device.UploadFirmware([]byte{}, [32]byte{})
suite.Equal(err, tc.err)
}

Expand Down

0 comments on commit 6484cf9

Please sign in to comment.