refactor: merge libminiooni into cmd/miniooni (#268)

We used to have an external package called libminiooni so that
third parties could use it. We wrote this such that we could
support github.com/bassosimone/aladdin.

That was actually a not-so-good idea because it added to the APIs
we needed to maintain.

Since the merge of engine into cli, such an API is not public
anymore and aladdin has been deprecated and archived.

Therefore, we can now cleanup the situation and merge libminiooni
into miniooni again, thus making the codebase more local.

This cleanup has been identified while working on
https://github.com/ooni/probe/issues/1299.
This commit is contained in:
Simone Basso 2021-03-29 19:03:53 +02:00 committed by GitHub
parent 5973c88a05
commit f5b5ac47b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 55 deletions

View File

@ -3,6 +3,7 @@
This directory contains the source code of a simple CLI client that we
use for research as well as for running QA scripts. We designed this tool
to have a CLI similar to MK and OONI Probe v2.x to ease running Jafar
scripts that check whether these tools behave similarly.
See also libminiooni.
scripts that check whether these tools behave similarly. Perfect backwards
compatibility was not a design goal for miniooni. Rather, we aimed to
have as little conflict as possible, such that we can run side-by-side
QA checks.

View File

@ -1,21 +1,4 @@
// Package libminiooni implements the cmd/miniooni CLI. Miniooni is our
// experimental client used for research and QA testing.
//
// This CLI has CLI options that do not conflict with Measurement Kit
// v0.10.x CLI options. There are some options conflict with the legacy
// OONI Probe CLI options. Perfect backwards compatibility is not a
// design goal for miniooni. Rather, we aim to have as little conflict
// as possible such that we can run side by side QA checks.
//
// We extracted this package from cmd/miniooni to allow us to further
// integrate the miniooni CLI into other binaries (see for example the
// code at github.com/bassosimone/aladdin).
package libminiooni
// TODO(bassosimone): now that this code cannot be imported from
// external sources anymore, we should move it back into the
// internal/cmd/miniooni folder and reduce the number of packages
// that are unnecessarily exposed inside ./internal/engine.
package main
// TODO(bassosimone): we need to deprecate or remove --limit.

View File

@ -0,0 +1,12 @@
package main
import "testing"
func TestSimple(t *testing.T) {
if testing.Short() {
t.Skip("skip test in short mode")
}
MainWithConfiguration("example", Options{
Yes: true,
})
}

View File

@ -1,14 +1,10 @@
// Command miniooni is a simple binary for research and QA purposes
// with a CLI interface similar to MK and OONI Probe v2.x.
//
// See also libminiooni, which is where we implement this CLI.
package main
import (
"fmt"
"os"
"github.com/ooni/probe-cli/v3/internal/libminiooni"
)
func main() {
@ -17,5 +13,5 @@ func main() {
fmt.Fprintf(os.Stderr, "%s", s)
}
}()
libminiooni.Main()
Main()
}

View File

@ -1,13 +0,0 @@
# Package github.com/ooni/probe-cli/internal/libminiooni
Package libminiooni implements the cmd/miniooni CLI. Miniooni is our
experimental client used for research and QA testing.
This CLI has CLI options that do not conflict with Measurement Kit
v0.10.x CLI options. There are some options conflict with the legacy
OONI Probe CLI options. Perfect backwards compatibility is not a
design goal for miniooni. Rather, we aim to have as little conflict
as possible such that we can run side by side QA checks.
This package was split off from cmd/miniooni in ooni/probe-engine. For
now we are keeping this split, but we will merge them in the future.

View File

@ -1,16 +0,0 @@
package libminiooni_test
import (
"testing"
"github.com/ooni/probe-cli/v3/internal/libminiooni"
)
func TestSimple(t *testing.T) {
if testing.Short() {
t.Skip("skip test in short mode")
}
libminiooni.MainWithConfiguration("example", libminiooni.Options{
Yes: true,
})
}