feat(snowflake): upgrade to v2 (+ small tweaks) (#667)

This diff contains the following changes and enhancements:

1. upgrade snowflake to v2

2. observe that we were not changing defaults from outside of snowflake.go, so remove code allowing to do that;

3. bump the timeout to 600 seconds (it seems 300 was not always enough based on my testing);

4. add useful knob to disable `torsf` progress (it's really annoying on console, we should do something about this);

5. ptx.go: avoid printing an error when the connection has just been closed;

6. snowflake: test AMP cache, see that it's not working currently, so leave it disabled.

Related issues: https://github.com/ooni/probe/issues/1845, https://github.com/ooni/probe/issues/1894, and https://github.com/ooni/probe/issues/1917.
This commit is contained in:
Simone Basso
2022-01-19 17:23:27 +01:00
committed by GitHub
parent 4342543934
commit cfb054efd4
7 changed files with 49 additions and 81 deletions
+9 -5
View File
@@ -16,10 +16,12 @@ import (
)
// testVersion is the tor experiment version.
const testVersion = "0.1.0"
const testVersion = "0.1.1"
// Config contains the experiment config.
type Config struct{}
type Config struct {
DisableProgress bool `ooni:"Disable printing progress messages"`
}
// TestKeys contains the experiment's result.
type TestKeys struct {
@@ -74,7 +76,7 @@ func (m *Measurer) Run(
testkeys := &TestKeys{}
measurement.TestKeys = testkeys
start := time.Now()
const maxRuntime = 300 * time.Second
const maxRuntime = 600 * time.Second
ctx, cancel := context.WithTimeout(ctx, maxRuntime)
defer cancel()
errch := make(chan error)
@@ -87,8 +89,10 @@ func (m *Measurer) Run(
callbacks.OnProgress(1.0, "torsf experiment is finished")
return err
case <-ticker.C:
progress := time.Since(start).Seconds() / maxRuntime.Seconds()
callbacks.OnProgress(progress, "torsf experiment is running")
if !m.config.DisableProgress {
progress := time.Since(start).Seconds() / maxRuntime.Seconds()
callbacks.OnProgress(progress, "torsf experiment is running")
}
}
}
}
@@ -18,7 +18,7 @@ func TestExperimentNameAndVersion(t *testing.T) {
if m.ExperimentName() != "torsf" {
t.Fatal("invalid experiment name")
}
if m.ExperimentVersion() != "0.1.0" {
if m.ExperimentVersion() != "0.1.1" {
t.Fatal("invalid experiment version")
}
}