From a58dff3050c1ee12bd8341b1aec3842e3de59ece Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Fri, 13 Nov 2020 17:14:26 +0100 Subject: [PATCH] refactor: nettests is now an internal package (#165) I'm moving everything into internal packages since this ain't a library. While there, remove typo that was causing a build breakage. --- internal/cli/run/run.go | 2 +- internal/log/handlers/cli/results.go | 1 - {nettests => internal/nettests}/dash.go | 0 {nettests => internal/nettests}/facebook_messenger.go | 0 {nettests => internal/nettests}/groups.go | 0 .../nettests}/http_header_field_manipulation.go | 0 {nettests => internal/nettests}/http_invalid_request_line.go | 0 {nettests => internal/nettests}/ndt.go | 0 {nettests => internal/nettests}/nettests.go | 0 {nettests => internal/nettests}/nettests_test.go | 2 +- {nettests => internal/nettests}/psiphon.go | 0 {nettests => internal/nettests}/telegram.go | 0 {nettests => internal/nettests}/tor.go | 0 {nettests => internal/nettests}/web_connectivity.go | 0 {nettests => internal/nettests}/whatsapp.go | 0 15 files changed, 2 insertions(+), 3 deletions(-) rename {nettests => internal/nettests}/dash.go (100%) rename {nettests => internal/nettests}/facebook_messenger.go (100%) rename {nettests => internal/nettests}/groups.go (100%) rename {nettests => internal/nettests}/http_header_field_manipulation.go (100%) rename {nettests => internal/nettests}/http_invalid_request_line.go (100%) rename {nettests => internal/nettests}/ndt.go (100%) rename {nettests => internal/nettests}/nettests.go (100%) rename {nettests => internal/nettests}/nettests_test.go (93%) rename {nettests => internal/nettests}/psiphon.go (100%) rename {nettests => internal/nettests}/telegram.go (100%) rename {nettests => internal/nettests}/tor.go (100%) rename {nettests => internal/nettests}/web_connectivity.go (100%) rename {nettests => internal/nettests}/whatsapp.go (100%) diff --git a/internal/cli/run/run.go b/internal/cli/run/run.go index c1f3892..51f2a92 100644 --- a/internal/cli/run/run.go +++ b/internal/cli/run/run.go @@ -10,7 +10,7 @@ import ( "github.com/ooni/probe-cli/internal/cli/onboard" "github.com/ooni/probe-cli/internal/cli/root" "github.com/ooni/probe-cli/internal/database" - "github.com/ooni/probe-cli/nettests" + "github.com/ooni/probe-cli/internal/nettests" ) func runNettestGroup(tg string, ctx *ooni.Context, network *database.Network) error { diff --git a/internal/log/handlers/cli/results.go b/internal/log/handlers/cli/results.go index 1850f4b..faee35a 100644 --- a/internal/log/handlers/cli/results.go +++ b/internal/log/handlers/cli/results.go @@ -84,7 +84,6 @@ func makeSummary(name string, totalCount uint64, anomalyCount uint64, ss string) func logResultItem(w io.Writer, f log.Fields) error { colWidth := 24 -Try running rID := f.Get("id").(int64) name := f.Get("name").(string) isDone := f.Get("is_done").(bool) diff --git a/nettests/dash.go b/internal/nettests/dash.go similarity index 100% rename from nettests/dash.go rename to internal/nettests/dash.go diff --git a/nettests/facebook_messenger.go b/internal/nettests/facebook_messenger.go similarity index 100% rename from nettests/facebook_messenger.go rename to internal/nettests/facebook_messenger.go diff --git a/nettests/groups.go b/internal/nettests/groups.go similarity index 100% rename from nettests/groups.go rename to internal/nettests/groups.go diff --git a/nettests/http_header_field_manipulation.go b/internal/nettests/http_header_field_manipulation.go similarity index 100% rename from nettests/http_header_field_manipulation.go rename to internal/nettests/http_header_field_manipulation.go diff --git a/nettests/http_invalid_request_line.go b/internal/nettests/http_invalid_request_line.go similarity index 100% rename from nettests/http_invalid_request_line.go rename to internal/nettests/http_invalid_request_line.go diff --git a/nettests/ndt.go b/internal/nettests/ndt.go similarity index 100% rename from nettests/ndt.go rename to internal/nettests/ndt.go diff --git a/nettests/nettests.go b/internal/nettests/nettests.go similarity index 100% rename from nettests/nettests.go rename to internal/nettests/nettests.go diff --git a/nettests/nettests_test.go b/internal/nettests/nettests_test.go similarity index 93% rename from nettests/nettests_test.go rename to internal/nettests/nettests_test.go index 4203282..a557a34 100644 --- a/nettests/nettests_test.go +++ b/internal/nettests/nettests_test.go @@ -16,7 +16,7 @@ func newTestingContext(t *testing.T) *ooni.Context { t.Fatal(err) } configPath := path.Join(homePath, "config.json") - testingConfig := path.Join("..", "testdata", "testing-config.json") + testingConfig := path.Join("..", "..", "testdata", "testing-config.json") shutil.Copy(testingConfig, configPath, false) ctx := ooni.NewContext(configPath, homePath) swName := "ooniprobe-cli-tests" diff --git a/nettests/psiphon.go b/internal/nettests/psiphon.go similarity index 100% rename from nettests/psiphon.go rename to internal/nettests/psiphon.go diff --git a/nettests/telegram.go b/internal/nettests/telegram.go similarity index 100% rename from nettests/telegram.go rename to internal/nettests/telegram.go diff --git a/nettests/tor.go b/internal/nettests/tor.go similarity index 100% rename from nettests/tor.go rename to internal/nettests/tor.go diff --git a/nettests/web_connectivity.go b/internal/nettests/web_connectivity.go similarity index 100% rename from nettests/web_connectivity.go rename to internal/nettests/web_connectivity.go diff --git a/nettests/whatsapp.go b/internal/nettests/whatsapp.go similarity index 100% rename from nettests/whatsapp.go rename to internal/nettests/whatsapp.go