feat: tlsping and tcpping using step-by-step (#815)

## Checklist

- [x] I have read the [contribution guidelines](https://github.com/ooni/probe-cli/blob/master/CONTRIBUTING.md)
- [x] reference issue for this pull request: https://github.com/ooni/probe/issues/2158
- [x] if you changed anything related how experiments work and you need to reflect these changes in the ooni/spec repository, please link to the related ooni/spec pull request: https://github.com/ooni/spec/pull/250

## Description

This diff refactors the codebase to reimplement tlsping and tcpping
to use the step-by-step measurements style.

See docs/design/dd-003-step-by-step.md for more information on the
step-by-step measurement style.
This commit is contained in:
Simone Basso
2022-07-01 12:22:22 +02:00
committed by GitHub
parent 5371c7f486
commit 5ebdeb56ca
48 changed files with 2825 additions and 299 deletions
+4 -4
View File
@@ -13,10 +13,10 @@ import (
"testing"
"github.com/google/go-cmp/cmp"
"github.com/ooni/probe-cli/v3/internal/fakefill"
"github.com/ooni/probe-cli/v3/internal/model"
"github.com/ooni/probe-cli/v3/internal/model/mocks"
"github.com/ooni/probe-cli/v3/internal/netxlite"
"github.com/ooni/probe-cli/v3/internal/testingx"
"github.com/ooni/probe-cli/v3/internal/version"
)
@@ -47,7 +47,7 @@ func TestAPIClientTemplate(t *testing.T) {
HTTPClient: http.DefaultClient,
Logger: model.DiscardLogger,
}
ff := &fakefill.Filler{}
ff := &testingx.FakeFiller{}
ff.Fill(tmpl)
ac := tmpl.Build()
orig := apiClient(*tmpl)
@@ -64,7 +64,7 @@ func TestAPIClientTemplate(t *testing.T) {
HTTPClient: http.DefaultClient,
Logger: model.DiscardLogger,
}
ff := &fakefill.Filler{}
ff := &testingx.FakeFiller{}
ff.Fill(tmpl)
tok := ""
ff.Fill(&tok)
@@ -188,7 +188,7 @@ func TestAPIClient(t *testing.T) {
t.Run("sets the content-type properly", func(t *testing.T) {
var jsonReq fakeRequest
ff := &fakefill.Filler{}
ff := &testingx.FakeFiller{}
ff.Fill(&jsonReq)
client := newAPIClient()
req, err := client.newRequestWithJSONBody(