d922bd9afc
The objective is to make PR checks run much faster. See https://github.com/ooni/probe/issues/2113 for context. Regarding netxlite's tests: Checking for every commit on master or on a release branch is good enough and makes pull requests faster than one minute since netxlite for windows is now 1m slower than coverage. We're losing some coverage but coverage from integration tests is not so good anyway, so I'm not super sad about this loss.
49 lines
735 B
Go
49 lines
735 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func init() {
|
|
*reportid = `20201209T052225Z_urlgetter_IT_30722_n1_E1VUhMz08SEkgYFU`
|
|
*input = `https://www.example.org`
|
|
}
|
|
|
|
func TestCheck(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("skip test in short mode")
|
|
}
|
|
*mode = "check"
|
|
main()
|
|
}
|
|
|
|
func TestRaw(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("skip test in short mode")
|
|
}
|
|
*mode = "raw"
|
|
main()
|
|
}
|
|
|
|
func TestMeta(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("skip test in short mode")
|
|
}
|
|
*mode = "meta"
|
|
main()
|
|
}
|
|
|
|
func TestInvalidMode(t *testing.T) {
|
|
defer func() {
|
|
if recover() == nil {
|
|
t.Fatal("the code did not panic")
|
|
}
|
|
}()
|
|
osExit = func(code int) {
|
|
panic(fmt.Errorf("%d", code))
|
|
}
|
|
*mode = "antani"
|
|
main()
|
|
}
|