From ee04895bb06d3ba271960973370b769ce83351af Mon Sep 17 00:00:00 2001 From: Laurent Senta Date: Tue, 2 May 2023 16:46:25 +0200 Subject: [PATCH] refactor: clearer MakeAPI* --- coreiface/tests/api.go | 8 ++++---- coreiface/tests/dht.go | 6 +++--- coreiface/tests/name.go | 6 +++--- coreiface/tests/pubsub.go | 2 +- coreiface/tests/routing.go | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/coreiface/tests/api.go b/coreiface/tests/api.go index cfcf0c976..f30990512 100644 --- a/coreiface/tests/api.go +++ b/coreiface/tests/api.go @@ -37,10 +37,6 @@ func (tp *TestSuite) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { return api[0], nil } -func (tp *TestSuite) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) { - return tp.makeAPISwarm(ctx, fullIdentity, fullIdentity, n) -} - func (tp *TestSuite) makeAPIWithIdentityAndOffline(ctx context.Context) (coreiface.CoreAPI, error) { api, err := tp.makeAPISwarm(ctx, true, false, 1) if err != nil { @@ -50,6 +46,10 @@ func (tp *TestSuite) makeAPIWithIdentityAndOffline(ctx context.Context) (coreifa return api[0], nil } +func (tp *TestSuite) MakeAPISwarm(ctx context.Context, n int) ([]coreiface.CoreAPI, error) { + return tp.makeAPISwarm(ctx, true, true, n) +} + type TestSuite struct { Provider diff --git a/coreiface/tests/dht.go b/coreiface/tests/dht.go index fb3f6d1a0..61f9fd687 100644 --- a/coreiface/tests/dht.go +++ b/coreiface/tests/dht.go @@ -26,7 +26,7 @@ func (tp *TestSuite) TestDht(t *testing.T) { func (tp *TestSuite) TestDhtFindPeer(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, 5) if err != nil { t.Fatal(err) } @@ -81,7 +81,7 @@ func (tp *TestSuite) TestDhtFindPeer(t *testing.T) { func (tp *TestSuite) TestDhtFindProviders(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, 5) if err != nil { t.Fatal(err) } @@ -113,7 +113,7 @@ func (tp *TestSuite) TestDhtFindProviders(t *testing.T) { func (tp *TestSuite) TestDhtProvide(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, 5) if err != nil { t.Fatal(err) } diff --git a/coreiface/tests/name.go b/coreiface/tests/name.go index a67876cba..a669e0c02 100644 --- a/coreiface/tests/name.go +++ b/coreiface/tests/name.go @@ -43,7 +43,7 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() init := func() (coreiface.CoreAPI, path.Path) { - apis, err := tp.MakeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, 5) if err != nil { t.Fatal(err) return nil, nil @@ -191,7 +191,7 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { func (tp *TestSuite) TestBasicPublishResolveKey(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, 5) if err != nil { t.Fatal(err) } @@ -235,7 +235,7 @@ func (tp *TestSuite) TestBasicPublishResolveTimeout(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, 5) if err != nil { t.Fatal(err) } diff --git a/coreiface/tests/pubsub.go b/coreiface/tests/pubsub.go index 446e0771a..24a8ac309 100644 --- a/coreiface/tests/pubsub.go +++ b/coreiface/tests/pubsub.go @@ -24,7 +24,7 @@ func (tp *TestSuite) TestBasicPubSub(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 2) + apis, err := tp.MakeAPISwarm(ctx, 2) if err != nil { t.Fatal(err) } diff --git a/coreiface/tests/routing.go b/coreiface/tests/routing.go index deeccde0b..c5486aa72 100644 --- a/coreiface/tests/routing.go +++ b/coreiface/tests/routing.go @@ -48,7 +48,7 @@ func (tp *TestSuite) TestRoutingGet(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 2) + apis, err := tp.MakeAPISwarm(ctx, 2) if err != nil { t.Fatal(err) } @@ -77,7 +77,7 @@ func (tp *TestSuite) TestRoutingGet(t *testing.T) { func (tp *TestSuite) TestRoutingPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 2) + apis, err := tp.MakeAPISwarm(ctx, 2) if err != nil { t.Fatal(err) }