feat(oonirun): implement OONIRun v1 (#843)
This diff adds support for running OONIRun v1 links. Run with `miniooni` using: ``` ./miniooni -i LINK oonirun ``` Part of https://github.com/ooni/probe/issues/2184
This commit is contained in:
parent
0b4a49190a
commit
ebb78c2848
4 changed files with 259 additions and 1 deletions
36
internal/oonirun/v1_test.go
Normal file
36
internal/oonirun/v1_test.go
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package oonirun
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/ooni/probe-cli/v3/internal/kvstore"
|
||||
)
|
||||
|
||||
// TODO(bassosimone): it would be cool to write unit tests. However, to do that
|
||||
// we need to ~redesign the engine package for unit-testability.
|
||||
|
||||
func TestOONIRunV1Link(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
config := &LinkConfig{
|
||||
AcceptChanges: false,
|
||||
Annotations: map[string]string{
|
||||
"platform": "linux",
|
||||
},
|
||||
KVStore: &kvstore.Memory{},
|
||||
MaxRuntime: 0,
|
||||
NoCollector: true,
|
||||
NoJSON: true,
|
||||
Random: false,
|
||||
ReportFile: "",
|
||||
Session: newSession(ctx, t),
|
||||
}
|
||||
r := NewLinkRunner(config, "https://run.ooni.io/nettest?tn=example&mv=1.2.0")
|
||||
if err := r.Run(ctx); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
r = NewLinkRunner(config, "ooni://nettest?tn=example&mv=1.2.0")
|
||||
if err := r.Run(ctx); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue