cleanup: move legacy from internal/engine to internal (#759)
No functional change. See https://github.com/ooni/probe/issues/2115
This commit is contained in:
parent
2d721baa91
commit
8b0815efab
6 changed files with 3 additions and 7 deletions
|
|
@ -1,40 +0,0 @@
|
|||
package assetsdir
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCleanupNormalUsage(t *testing.T) {
|
||||
result, err := Cleanup("testdata")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// we expect a bunch of ENOENT because the directory does not exist.
|
||||
isExpectedErr := func(err error) bool {
|
||||
return err != nil && strings.HasSuffix(err.Error(), "no such file or directory")
|
||||
}
|
||||
if !isExpectedErr(result.ASNDatabaseErr) {
|
||||
t.Fatal("unexpected error", result.ASNDatabaseErr)
|
||||
}
|
||||
if !isExpectedErr(result.CABundleErr) {
|
||||
t.Fatal("unexpected error", result.CABundleErr)
|
||||
}
|
||||
if !isExpectedErr(result.CountryDatabaseErr) {
|
||||
t.Fatal("unexpected error", result.CountryDatabaseErr)
|
||||
}
|
||||
if !isExpectedErr(result.RmdirErr) {
|
||||
t.Fatal("unexpected error", result.RmdirErr)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCleanupWithEmptyInput(t *testing.T) {
|
||||
result, err := Cleanup("")
|
||||
if !errors.Is(err, ErrEmptyDir) {
|
||||
t.Fatal("unexpected error", err)
|
||||
}
|
||||
if result != nil {
|
||||
t.Fatal("expected nil result")
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue