forked from ooni/probe-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inputloader_network_test.go
45 lines (42 loc) · 1.06 KB
/
inputloader_network_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package engine_test
import (
"context"
"testing"
"github.com/apex/log"
engine "github.com/ooni/probe-cli/v3/internal/engine"
"github.com/ooni/probe-cli/v3/internal/kvstore"
"github.com/ooni/probe-cli/v3/internal/model"
)
func TestInputLoaderInputOrQueryBackendWithNoInput(t *testing.T) {
if testing.Short() {
t.Skip("skip test in short mode")
}
sess, err := engine.NewSession(context.Background(), engine.SessionConfig{
AvailableProbeServices: []model.OOAPIService{{
Address: "https://ams-pg-test.ooni.org/",
Type: "https",
}},
KVStore: &kvstore.Memory{},
Logger: log.Log,
SoftwareName: "miniooni",
SoftwareVersion: "0.1.0-dev",
TempDir: "testdata",
})
if err != nil {
t.Fatal(err)
}
defer sess.Close()
il := &engine.InputLoader{
InputPolicy: model.InputOrQueryBackend,
Session: sess,
}
ctx := context.Background()
out, err := il.Load(ctx)
if err != nil {
t.Fatal(err)
}
if len(out) < 10 {
// check-in SHOULD return AT LEAST 20 URLs at a time.
t.Fatal("not the output length we expected")
}
}