Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.

Commit ce4f467

Browse files
committed
make sure PDK can use latest go-pilosa options
1 parent 506206d commit ce4f467

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ require (
2323
github.com/onsi/ginkgo v1.7.0 // indirect
2424
github.com/onsi/gomega v1.4.3 // indirect
2525
github.com/pierrec/lz4 v0.0.0-20181005164709-635575b42742 // indirect
26-
github.com/pilosa/go-pilosa v1.3.1-0.20190503193736-ad53edf56c18
26+
github.com/pilosa/go-pilosa v1.3.1-0.20190612142550-e616c1393660
2727
github.com/pilosa/pilosa v1.2.1-0.20190410162749-b973f8c96356
2828
github.com/pkg/errors v0.8.1
2929
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ github.com/pilosa/go-pilosa v1.2.1-0.20190416174400-de264d55e76f h1:faokUYJ6BwIK
130130
github.com/pilosa/go-pilosa v1.2.1-0.20190416174400-de264d55e76f/go.mod h1:x18hYx4nI0bHzQSFyanUEB7pmja1HMAZAb3PPhUpOZc=
131131
github.com/pilosa/go-pilosa v1.3.1-0.20190503193736-ad53edf56c18 h1:uUA588w4MeX0dFxhr0rj1XazSxaSwqL3qnG2MmTZRb8=
132132
github.com/pilosa/go-pilosa v1.3.1-0.20190503193736-ad53edf56c18/go.mod h1:9ECbvb0EQJvjxBups5CUCzeLh8KrLgQVY9/1zSoQHQE=
133+
github.com/pilosa/go-pilosa v1.3.1-0.20190612142550-e616c1393660 h1:0UUfONtKBe4n1yIRLshVPNCJbtXdg/WKNLDqmCxu/uw=
134+
github.com/pilosa/go-pilosa v1.3.1-0.20190612142550-e616c1393660/go.mod h1:9ECbvb0EQJvjxBups5CUCzeLh8KrLgQVY9/1zSoQHQE=
133135
github.com/pilosa/pilosa v0.0.0-20181130171212-dfb748ec5b01 h1:gtkt282G8/+8XN0D9+934/3zpUiEtsFINjqCs+vZs04=
134136
github.com/pilosa/pilosa v0.0.0-20181130171212-dfb748ec5b01/go.mod h1:NgpkJkefqUKUHV7O3TqBOu89tsao3ksth2wzTNe8CPQ=
135137
github.com/pilosa/pilosa v0.0.0-20190104143002-8c4b1548bc4b h1:2H/+JUxL4dv0uJ4G4i+C83S1yq/+pUrHHjsF8TEY85I=

pilosa.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ func (i *Index) setupField(field *gopilosa.Field) error {
222222
// Example:
223223
// pdk.SetupPilosa(...,
224224
// pdk.OptPilosaImportOptions(gopilosa.OptImportThreadCount(4)),
225-
// pdkOptPilosaClientOptions(gopilosa.OptClientRetries(5), gopilosa.OptClientConnectTimeout(time.Second * 60))
225+
// pdk.OptPilosaClientOptions(gopilosa.OptClientRetries(5), gopilosa.OptClientConnectTimeout(time.Second * 60))
226226
// )
227227

228228
func SetupPilosa(hosts []string, indexName string, schema *gopilosa.Schema, batchsize uint, options ...PilosaOption) (Indexer, error) {

pilosa_test.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
package pdk_test
3434

3535
import (
36+
"io/ioutil"
37+
"os"
3638
"testing"
3739
"time"
3840

@@ -55,7 +57,12 @@ func TestSetupPilosa(t *testing.T) {
5557
index.Field("field3", gopilosa.OptFieldTypeInt(0, 20000))
5658
index.Field("fieldtime", gopilosa.OptFieldTypeTime(gopilosa.TimeQuantumYearMonthDay))
5759

58-
indexer, err := pdk.SetupPilosa(hosts, index.Name(), schema, 2)
60+
logfile, err := ioutil.TempFile("", "")
61+
if err != nil {
62+
t.Fatalf("getting temp file for import log: %v", err)
63+
}
64+
65+
indexer, err := pdk.SetupPilosa(hosts, index.Name(), schema, 2, pdk.OptPilosaImportOptions(gopilosa.OptImportThreadCount(4)), pdk.OptPilosaClientOptions(gopilosa.ExperimentalOptClientLogImports(logfile)))
5966
if err != nil {
6067
t.Fatalf("SetupPilosa: %v", err)
6168
}
@@ -70,6 +77,18 @@ func TestSetupPilosa(t *testing.T) {
7077
if err != nil {
7178
t.Fatalf("closing indexer: %v", err)
7279
}
80+
logfile.Close()
81+
f, err := os.Open(logfile.Name())
82+
if err != nil {
83+
t.Fatalf("reopening log file: %v", err)
84+
}
85+
data, err := ioutil.ReadAll(f)
86+
if err != nil {
87+
t.Fatalf("reading log file: %v", err)
88+
}
89+
if len(data) < 100 {
90+
t.Errorf("small amount of data in replay file: %s", data)
91+
}
7392

7493
client, err := gopilosa.NewClient(hosts)
7594
if err != nil {

0 commit comments

Comments
 (0)