From c90248920aca38f1de44f1e02d887f56984080b0 Mon Sep 17 00:00:00 2001 From: Gjorgji Slamkov Date: Thu, 10 Aug 2023 12:19:59 +0000 Subject: [PATCH] ci(GODT-2717): Create a job that will run on schedule --- .gitlab-ci.yml | 17 +++++++++++++++++ Makefile | 9 +++++++++ tests/bdd_test.go | 16 ++++++++++++++++ .../user/sync_high_number.feature} | 1 + 4 files changed, 43 insertions(+) rename tests/{features_long/user/sync.feature => features/user/sync_high_number.feature} (99%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e415c174..f3302a8e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,6 +47,16 @@ stages: allow_failure: true - when: never +.rules-branch-manual-scheduled-and-test-branch-always: + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_BRANCH =~ /(test\/)/ + when: always + allow_failure: false + - if: $CI_COMMIT_BRANCH + when: manual + allow_failure: true + - when: never + # ENV .env-windows: before_script: @@ -172,6 +182,13 @@ test-integration-race: script: - make test-integration-race +test-integration-nightly: + extends: + - test-integration + - .rules-branch-manual-scheduled-and-test-branch-always + script: + - make test-integration-nightly + test-windows: extends: - .env-windows diff --git a/Makefile b/Makefile index 5addbd4e..d69b53cb 100644 --- a/Makefile +++ b/Makefile @@ -258,6 +258,15 @@ test-integration-debug: gofiles test-integration-race: gofiles go test -v -timeout=60m -p=1 -count=1 -race -failfast github.com/ProtonMail/proton-bridge/v3/tests +test-integration-nightly: gofiles + mkdir -p coverage/integration + go test \ + -v -timeout=90m -p=1 -count=1 \ + ${GOCOVERAGE} \ + github.com/ProtonMail/proton-bridge/v3/tests \ + ${GOCOVERDIR}/integration \ + nightly + fuzz: gofiles go test -fuzz=FuzzUnmarshal -parallel=4 -fuzztime=60s $(PWD)/internal/legacy/credentials go test -fuzz=FuzzNewParser -parallel=4 -fuzztime=60s $(PWD)/pkg/message/parser diff --git a/tests/bdd_test.go b/tests/bdd_test.go index f28877ad..658acbaf 100644 --- a/tests/bdd_test.go +++ b/tests/bdd_test.go @@ -267,6 +267,7 @@ func TestFeatures(testingT *testing.T) { Format: "pretty", Paths: getFeaturePaths(), TestingT: testingT, + Tags: getFeatureTags(), }, } @@ -286,3 +287,18 @@ func getFeaturePaths() []string { return paths } + +func getFeatureTags() string { + var tags string + + switch arguments := os.Args; arguments[len(arguments)-1] { + case "nightly": + tags = "" + case "smoke": // Currently this is just a placeholder, as there are no scenarios tagged with @smoke + tags = "@smoke" + default: + tags = "~@regression && ~@smoke" // To exclude more add `&& ~@tag` + } + + return tags +} diff --git a/tests/features_long/user/sync.feature b/tests/features/user/sync_high_number.feature similarity index 99% rename from tests/features_long/user/sync.feature rename to tests/features/user/sync_high_number.feature index d72d4e4c..1a9585e9 100644 --- a/tests/features_long/user/sync.feature +++ b/tests/features/user/sync_high_number.feature @@ -1,3 +1,4 @@ +@regression Feature: Bridge can fully synchronize an account with high number of messages, and correct number of messages is shown in client Background: Given there exists an account with username "[user:user]" and password "password"