From 43ebc2ef3383c06b96de224e033bc2c103b1c585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fan=20Can=20Bak=C4=B1r?= Date: Mon, 21 Aug 2023 11:45:27 +0000 Subject: [PATCH 1/2] use `-short`mode for excluding long running tests --- .github/workflows/build-test.yml | 8 +++++++- v2/pkg/passive/sources_w_auth_test.go | 4 ++++ v2/pkg/passive/sources_wo_auth_test.go | 4 ++++ v2/pkg/subscraping/sources/facebook/ctlogs_test.go | 4 ++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index aa01cc015..d9df3941f 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -6,6 +6,12 @@ on: - '**.go' - '**.mod' workflow_dispatch: + inputs: + short: + description: 'Use -short flag for tests' + required: false + type: boolean + default: 'false' jobs: build: @@ -59,7 +65,7 @@ jobs: with: timeout_seconds: 360 max_attempts: 3 - command: cd v2; go test ./... -v + command: cd v2; go test ./... -v ${{ github.event.inputs.short == 'true' && '-short' || '' }} - name: Race Condition Tests run: go build -race ./... diff --git a/v2/pkg/passive/sources_w_auth_test.go b/v2/pkg/passive/sources_w_auth_test.go index ffbe46bfd..98758a078 100644 --- a/v2/pkg/passive/sources_w_auth_test.go +++ b/v2/pkg/passive/sources_w_auth_test.go @@ -19,6 +19,10 @@ import ( ) func TestSourcesWithKeys(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + domain := "hackerone.com" timeout := 60 diff --git a/v2/pkg/passive/sources_wo_auth_test.go b/v2/pkg/passive/sources_wo_auth_test.go index 88f64e04b..d03ef912f 100644 --- a/v2/pkg/passive/sources_wo_auth_test.go +++ b/v2/pkg/passive/sources_wo_auth_test.go @@ -19,6 +19,10 @@ import ( ) func TestSourcesWithoutKeys(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + ignoredSources := []string{ "commoncrawl", // commoncrawl is under resourced and will likely time-out so step over it for this test https://groups.google.com/u/2/g/common-crawl/c/3QmQjFA_3y4/m/vTbhGqIBBQAJ "riddler", // Fails with 403: There might be too much traffic or a configuration error diff --git a/v2/pkg/subscraping/sources/facebook/ctlogs_test.go b/v2/pkg/subscraping/sources/facebook/ctlogs_test.go index 7de4141aa..8869e7901 100644 --- a/v2/pkg/subscraping/sources/facebook/ctlogs_test.go +++ b/v2/pkg/subscraping/sources/facebook/ctlogs_test.go @@ -18,6 +18,10 @@ var ( ) func TestFacebookSource(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + updateWithEnv(&fb_API_ID) updateWithEnv(&fb_API_SECRET) if generic.EqualsAny("", fb_API_ID, fb_API_SECRET) { From a7764d0904098580f437d5b438284f8735706626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fan=20Can=20Bak=C4=B1r?= Date: Mon, 21 Aug 2023 11:49:25 +0000 Subject: [PATCH 2/2] minor --- .github/workflows/build-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index d9df3941f..05b50a938 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -6,12 +6,12 @@ on: - '**.go' - '**.mod' workflow_dispatch: - inputs: + inputs: short: description: 'Use -short flag for tests' required: false type: boolean - default: 'false' + default: false jobs: build: