@cryptotaxi247 / kubo / commits / c23639373

Connect test swarms, don't compress api calls

This commit was moved from ipfs/go-ipfs-http-client@c6472d9b8286c932492db4d6bf03f890bf97759c

Łukasz Magiera committed Jan 8, 2019 at 02:08 UTC c236393733bf3491c45002d67189ba78303332a8
1 file changed +20 -1
client/httpapi/api_test.go
+20 -1
@@ -4,6 +4,7 @@ import (
4 "context"
5 "fmt"
6 "io/ioutil"
7 + gohttp "net/http"
8 "os"
9 "path"
10 "strconv"
@@ -50,6 +51,13 @@ func (NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int)
51 return nil, err
52 }
53
54 + if n > 1 {
55 + connectArgs := []string{"iptb", "--IPTB_ROOT", dir, "connect", fmt.Sprintf("[1-%d]", n - 1), "0"}
56 + if err := c.Run(connectArgs); err != nil {
57 + return nil, err
58 + }
59 + }
60 +
61 go func() {
62 <-ctx.Done()
63
@@ -80,7 +88,18 @@ func (NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int)
88 return nil, err
89 }
90
83 - apis[i] = NewPathApi(pth)
91 + a := ApiAddr(pth)
92 + if a == nil {
93 + return nil, fmt.Errorf("nil addr for node")
94 + }
95 + c := &gohttp.Client{
96 + Transport: &gohttp.Transport{
97 + Proxy: gohttp.ProxyFromEnvironment,
98 + DisableKeepAlives: true,
99 + DisableCompression: true,
100 + },
101 + }
102 + apis[i] = NewApiWithClient(a, c)
103 }
104
105 return apis, nil