Skip to content

Commit

Permalink
feat(ooniprobe): add torsf to experimental group (#670)
Browse files Browse the repository at this point in the history
Reference issue: ooni/probe#1917.

I needed to change the summary key type returned by `torsf` to be a value. It seems the DB layer assumes that. If we pass it a pointer, it panics because it's experiment a value rather than a pointer 🤷.
  • Loading branch information
bassosimone authored Jan 21, 2022
1 parent 97d2b5a commit a01f901
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/ooniprobe/internal/nettests/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ var All = map[string]Group{
Nettests: []Nettest{
DNSCheck{},
STUNReachability{},
TorSf{},
},
},
}
14 changes: 14 additions & 0 deletions cmd/ooniprobe/internal/nettests/torsf.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package nettests

// TorSf test implementation
type TorSf struct {
}

// Run starts the test
func (h TorSf) Run(ctl *Controller) error {
builder, err := ctl.Session.NewExperimentBuilder("torsf")
if err != nil {
return err
}
return ctl.Run(builder, []string{""})
}
2 changes: 1 addition & 1 deletion internal/engine/experiment/torsf/torsf.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,5 @@ type SummaryKeys struct {

// GetSummaryKeys implements model.ExperimentMeasurer.GetSummaryKeys.
func (m *Measurer) GetSummaryKeys(measurement *model.Measurement) (interface{}, error) {
return &SummaryKeys{IsAnomaly: false}, nil
return SummaryKeys{IsAnomaly: false}, nil
}
2 changes: 1 addition & 1 deletion internal/engine/experiment/torsf/torsf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func TestGetSummaryKeys(t *testing.T) {
if err != nil {
t.Fatal(err)
}
rsk := sk.(*SummaryKeys)
rsk := sk.(SummaryKeys)
if rsk.IsAnomaly {
t.Fatal("expected no anomaly here")
}
Expand Down

0 comments on commit a01f901

Please sign in to comment.