diff --git a/internal/sourcetest/sourcetest.go b/internal/sourcetest/sourcetest.go index 93c577c..766d7db 100644 --- a/internal/sourcetest/sourcetest.go +++ b/internal/sourcetest/sourcetest.go @@ -3,11 +3,14 @@ package sourcetest import ( + "os" "testing" "goyomi/internal/source" ) +var verboseOutput = os.Getenv("SOURCETEST_VERBOSE") == "1" + // Run verifies source metadata and, unless -short is set, calls GetPopularManga // and GetLatestUpdates (when supported) against the live site. func Run(t *testing.T, s source.CatalogueSource, wantName, wantLang string) { @@ -39,7 +42,7 @@ func Run(t *testing.T, s source.CatalogueSource, wantName, wantLang string) { if len(page.Mangas) == 0 { t.Fatal("GetPopularManga returned 0 results") } - if testing.Verbose() { + if verboseOutput { t.Logf("--- GetPopularManga (%d results) ---", len(page.Mangas)) for i, m := range page.Mangas { t.Logf(" [%d] %-60s %s", i, m.Title, m.URL) @@ -67,7 +70,7 @@ func Run(t *testing.T, s source.CatalogueSource, wantName, wantLang string) { if len(page.Mangas) == 0 { t.Fatal("GetLatestUpdates returned 0 results") } - if testing.Verbose() { + if verboseOutput { t.Logf("--- GetLatestUpdates (%d results) ---", len(page.Mangas)) for i, m := range page.Mangas { t.Logf(" [%d] %-60s %s", i, m.Title, m.URL) diff --git a/scripts/test-sources.sh b/scripts/test-sources.sh index 547ade9..0ec7a63 100755 --- a/scripts/test-sources.sh +++ b/scripts/test-sources.sh @@ -232,11 +232,12 @@ ok "Network $NETWORK exists" SHORT_FLAG="" VERBOSE_FLAG="" +VERBOSE_ENV="" FLAGS="" while [ $# -gt 0 ]; do case "$1" in -short) SHORT_FLAG="-short"; FLAGS="$FLAGS -short"; shift ;; - -v) VERBOSE_FLAG="-v"; FLAGS="$FLAGS -v"; shift ;; + -v) VERBOSE_FLAG="-v"; FLAGS="$FLAGS -v"; VERBOSE_ENV="-e SOURCETEST_VERBOSE=1"; shift ;; *) break ;; esac done @@ -262,6 +263,7 @@ set +e docker run --rm \ --network "$NETWORK" \ -e FLARESOLVERR_URL=http://flaresolverr:8191 \ + $VERBOSE_ENV \ -v "$REPO_ROOT":/workspace \ -v goyomi_go_mod_cache:/go/pkg/mod \ -v goyomi_go_build_cache:/root/.cache/go-build \