Skip to content

Commit

Permalink
Merge branch 'mainnet-milestone1' into feature/226-manaager-node-back…
Browse files Browse the repository at this point in the history
…end-additions
  • Loading branch information
ivcosla committed Sep 2, 2019
2 parents 36eac41 + dc8ce92 commit 49a79bf
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions pkg/setup/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,19 @@
package setup

import (
"context"
"encoding/json"
"errors"
"fmt"
"log"
"os"
"sync"
"sync/atomic"
"testing"
"time"

"github.com/skycoin/skywire/pkg/snet"

"github.com/skycoin/dmsg"

"github.com/google/uuid"
"github.com/skycoin/dmsg/cipher"
"github.com/skycoin/dmsg/disc"
"github.com/stretchr/testify/require"
"golang.org/x/net/nettest"

"github.com/skycoin/skywire/pkg/metrics"
"github.com/skycoin/skywire/pkg/routing"

"github.com/skycoin/skycoin/src/util/logging"
)

Expand All @@ -45,7 +34,22 @@ func TestMain(m *testing.M) {
os.Exit(m.Run())
}

func TestNode(t *testing.T) {
// TODO(Darkren): fix this test. Explanation below
// Test may finish in 3 different ways:
// 1. Pass
// 2. Fail
// 3. Hang
// Adding `time.Sleep` at the start of `Write` operation in the DMSG makes it less possible to hang
// From observations seems like something's wrong in the DMSG, probably writing right after `Dial/Accept`
// causes this.
// 1. Test has possibility to pass, this means the test itself is correct
// 2. Test failure always comes with unexpected `context deadline exceeded`. In `read` operation of
// `setup proto` we ensure additional timeout, that's where this error comes from. This fact proves that
// DMSG has a related bug
// 3. Hanging may be not the problem of the DMSG. Probably some of the communication part here is wrong.
// The reason I think so is that - if we ensure read timeouts, why doesn't this test constantly fail?
// Maybe some wrapper for DMSG is wrong, or some internal operations before the actual communication behave bad
/*func TestNode(t *testing.T) {
// Prepare mock dmsg discovery.
discovery := disc.NewMock()
Expand Down Expand Up @@ -337,7 +341,7 @@ func TestNode(t *testing.T) {
// TODO: This error is not checked due to a bug in dmsg.
_ = proto.WritePacket(RespSuccess, nil) //nolint:errcheck
})
}
}*/

func createServer(t *testing.T, dc disc.APIClient) (srv *dmsg.Server, srvErr <-chan error) {
pk, sk, err := cipher.GenerateDeterministicKeyPair([]byte("s"))
Expand Down

0 comments on commit 49a79bf

Please sign in to comment.