Skip to content

Commit

Permalink
fix: use berty custom mocknet
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton committed Jun 20, 2023
1 parent 82e525a commit ea21b64
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 25 deletions.
2 changes: 1 addition & 1 deletion account_export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/ipfs/go-cid"
ds "github.com/ipfs/go-datastore"
dsync "github.com/ipfs/go-datastore/sync"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/require"

orbitdb "berty.tech/go-orbit-db"
Expand Down
2 changes: 1 addition & 1 deletion contact_request_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

libp2p_mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
libp2p_mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down
2 changes: 1 addition & 1 deletion deactivate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

ds "github.com/ipfs/go-datastore"
dsync "github.com/ipfs/go-datastore/sync"
libp2p_mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
libp2p_mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/require"

"berty.tech/weshnet"
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ require (
filippo.io/edwards25519 v1.0.0
github.com/aead/ecdh v0.2.0
github.com/berty/emitter-go v0.0.0-20221031144724-5dae963c3622
github.com/berty/go-libp2p-rendezvous v0.4.1
github.com/berty/go-libp2p-mock v1.0.1
github.com/berty/go-libp2p-rendezvous v0.5.0
github.com/buicongtan1997/protoc-gen-swagger-config v0.0.0-20200705084907-1342b78c1a7e
github.com/daixiang0/gci v0.8.2
github.com/dgraph-io/badger/v2 v2.2007.3
Expand All @@ -28,7 +29,7 @@ require (
github.com/ipfs/interface-go-ipfs-core v0.11.1
github.com/ipfs/kubo v0.19.0
github.com/juju/fslock v0.0.0-20160525022230-4d5c94c67b4b
github.com/libp2p/go-libp2p v0.27.3
github.com/libp2p/go-libp2p v0.27.6
github.com/libp2p/go-libp2p-kad-dht v0.21.1
github.com/libp2p/go-libp2p-pubsub v0.9.3
github.com/libp2p/go-libp2p-record v0.2.0
Expand Down
10 changes: 6 additions & 4 deletions go.sum

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

2 changes: 1 addition & 1 deletion internal/handshake/handshake_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
p2pcrypto "github.com/libp2p/go-libp2p/core/crypto"
p2pnetwork "github.com/libp2p/go-libp2p/core/network"
p2ppeer "github.com/libp2p/go-libp2p/core/peer"
p2pmocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
p2pmocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/require"

"berty.tech/weshnet/pkg/ipfsutil"
Expand Down
2 changes: 1 addition & 1 deletion message_marshaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down
2 changes: 1 addition & 1 deletion orbitdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

datastore "github.com/ipfs/go-datastore"
sync_ds "github.com/ipfs/go-datastore/sync"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
Expand Down
14 changes: 11 additions & 3 deletions pkg/ipfsutil/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@ import (
"encoding/base64"
"testing"

p2p_mocknet "github.com/berty/go-libp2p-mock"
rendezvous "github.com/berty/go-libp2p-rendezvous"
p2p_rpdb "github.com/berty/go-libp2p-rendezvous/db/sqlcipher"
ds "github.com/ipfs/go-datastore"
dsync "github.com/ipfs/go-datastore/sync"
ipfs_cfg "github.com/ipfs/kubo/config"
ipfs_core "github.com/ipfs/kubo/core"
ipfs_mock "github.com/ipfs/kubo/core/mock"
ipfs_p2p "github.com/ipfs/kubo/core/node/libp2p"
ipfs_repo "github.com/ipfs/kubo/repo"
"github.com/libp2p/go-libp2p"
pubsub "github.com/libp2p/go-libp2p-pubsub"
p2p_ci "github.com/libp2p/go-libp2p/core/crypto"
host "github.com/libp2p/go-libp2p/core/host"
p2pnetwork "github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
p2p_peer "github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/peerstore"
"github.com/libp2p/go-libp2p/core/protocol"
p2p_mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
"github.com/stretchr/testify/require"
"go.uber.org/zap"

Expand Down Expand Up @@ -135,7 +137,7 @@ func TestingCoreAPIUsingMockNet(ctx context.Context, t testing.TB, opts *Testing
t.Cleanup(func() { mrepo.Close() })

mnode, err := NewIPFSMobile(ctx, mrepo, &MobileOptions{
HostOption: ipfs_mock.MockHostOption(opts.Mocknet),
HostOption: MockHostOption(opts.Mocknet),
RoutingOption: ipfs_p2p.NilRouterOption,
ExtraOpts: map[string]bool{
"pubsub": false,
Expand Down Expand Up @@ -257,3 +259,9 @@ func (m *coreAPIMock) Tinder() *tinder.Service {
func (m *coreAPIMock) Close() {
m.node.Close()
}

func MockHostOption(mn p2p_mocknet.Mocknet) ipfs_p2p.HostOption {
return func(id peer.ID, ps peerstore.Peerstore, _ ...libp2p.Option) (host.Host, error) {
return mn.AddPeerWithPeerstore(id, ps)
}
}
2 changes: 1 addition & 1 deletion pkg/rendezvous/emitterio_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
db "github.com/berty/go-libp2p-rendezvous/db/sqlcipher"
"github.com/berty/go-libp2p-rendezvous/test_utils"
"github.com/libp2p/go-libp2p/core/host"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/require"
"go.uber.org/zap"

Expand Down
2 changes: 1 addition & 1 deletion pkg/tinder/driver_localdiscovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/require"

"berty.tech/weshnet/pkg/testutil"
Expand Down
2 changes: 1 addition & 1 deletion pkg/tinder/driver_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/libp2p/go-libp2p/core/peer"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/tinder/driver_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
dht "github.com/libp2p/go-libp2p-kad-dht"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/peer"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/require"
"go.uber.org/zap"

Expand Down
2 changes: 1 addition & 1 deletion pkg/tinder/service_mocked_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/peer"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
Expand Down
2 changes: 1 addition & 1 deletion pkg/tinder/testing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
p2putil "github.com/libp2p/go-libp2p-testing/netutil"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/peer"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
mocknet "github.com/berty/go-libp2p-mock"
ma "github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion scenario_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"testing"
"time"

libp2p_mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
libp2p_mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/goleak"
Expand Down
2 changes: 1 addition & 1 deletion store_metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
datastore "github.com/ipfs/go-datastore"
ds_sync "github.com/ipfs/go-datastore/sync"
"github.com/libp2p/go-libp2p/core/crypto"
libp2p_mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
libp2p_mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
Expand Down
2 changes: 1 addition & 1 deletion testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
ds_sync "github.com/ipfs/go-datastore/sync"
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/peer"
libp2p_mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
libp2p_mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
Expand Down
2 changes: 1 addition & 1 deletion tinder_swiper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

p2pmocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
p2pmocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down

0 comments on commit ea21b64

Please sign in to comment.