From 5da86f34fd52b76cdfa7d6f0c02e0457c65d706c Mon Sep 17 00:00:00 2001 From: Mark Lapierre Date: Mon, 10 Jul 2023 11:58:32 +1000 Subject: [PATCH 1/4] Run streaming test --- .gitlab-ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 76d738aa..138dc858 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -124,13 +124,15 @@ package-and-test: needs: - package-and-test-env variables: - RELEASE: EE + QA_IMAGE: registry.gitlab.com/gitlab-org/gitlab/gitlab-ee-qa:8077d65e3e7857dabafc5c0b541e55ba2d4874c8 + RELEASE: registry.gitlab.com/gitlab-org/build/omnibus-gitlab-mirror/gitlab-ee:8077d65e3e7857dabafc5c0b541e55ba2d4874c8 RUN_WITH_BUNDLE: "true" SKIP_OMNIBUS_TRIGGER: "true" SKIP_REPORT_IN_ISSUES: "true" ALLURE_JOB_NAME: gitlab-qa UPDATE_QA_CACHE: $UPDATE_QA_CACHE GITLAB_QA_CACHE_KEY: $GITLAB_QA_CACHE_KEY + QA_RSPEC_TAGS: --seed 47331 inherit: variables: - RUBY_VERSION @@ -142,10 +144,10 @@ package-and-test: pipeline_variables: true include: - project: gitlab-org/gitlab - ref: master + ref: ml-test-streaming-events-test-last file: .gitlab/ci/package-and-test/main.gitlab-ci.yml rules: - if: '$CI_MERGE_REQUEST_IID' - when: manual + when: always allow_failure: true - - when: always \ No newline at end of file + - when: always -- GitLab From a6d6118af4d22e23210e9b39e85a1d3714d498e7 Mon Sep 17 00:00:00 2001 From: Mark Lapierre Date: Wed, 2 Aug 2023 06:06:52 +1000 Subject: [PATCH 2/4] Override network for specs container --- .gitlab-ci.yml | 12 ++++-------- lib/gitlab/qa/runtime/env.rb | 4 ++++ lib/gitlab/qa/scenario/test/instance/any.rb | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 138dc858..94a9f276 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -124,15 +124,15 @@ package-and-test: needs: - package-and-test-env variables: - QA_IMAGE: registry.gitlab.com/gitlab-org/gitlab/gitlab-ee-qa:8077d65e3e7857dabafc5c0b541e55ba2d4874c8 - RELEASE: registry.gitlab.com/gitlab-org/build/omnibus-gitlab-mirror/gitlab-ee:8077d65e3e7857dabafc5c0b541e55ba2d4874c8 + QA_IMAGE: registry.gitlab.com/gitlab-org/gitlab/gitlab-ee-qa:aed0830e783ec7ce48d1a9c2a23d92d48467cff2 + RELEASE: registry.gitlab.com/gitlab-org/build/omnibus-gitlab-mirror/gitlab-ee:aed0830e783ec7ce48d1a9c2a23d92d48467cff2 RUN_WITH_BUNDLE: "true" SKIP_OMNIBUS_TRIGGER: "true" SKIP_REPORT_IN_ISSUES: "true" ALLURE_JOB_NAME: gitlab-qa UPDATE_QA_CACHE: $UPDATE_QA_CACHE GITLAB_QA_CACHE_KEY: $GITLAB_QA_CACHE_KEY - QA_RSPEC_TAGS: --seed 47331 + QA_SPECS_NETWORK: test inherit: variables: - RUBY_VERSION @@ -146,8 +146,4 @@ package-and-test: - project: gitlab-org/gitlab ref: ml-test-streaming-events-test-last file: .gitlab/ci/package-and-test/main.gitlab-ci.yml - rules: - - if: '$CI_MERGE_REQUEST_IID' - when: always - allow_failure: true - - when: always + when: always diff --git a/lib/gitlab/qa/runtime/env.rb b/lib/gitlab/qa/runtime/env.rb index 29b9e0fc..a5aa53fd 100644 --- a/lib/gitlab/qa/runtime/env.rb +++ b/lib/gitlab/qa/runtime/env.rb @@ -431,6 +431,10 @@ module Gitlab enabled?(env_var_value_if_defined('QA_MOCK_GITHUB'), default: true) end + def specs_network + env_var_value_if_defined('QA_SPECS_NETWORK') + end + private def enabled?(value, default: true) diff --git a/lib/gitlab/qa/scenario/test/instance/any.rb b/lib/gitlab/qa/scenario/test/instance/any.rb index eddf23ba..ea55b5ae 100644 --- a/lib/gitlab/qa/scenario/test/instance/any.rb +++ b/lib/gitlab/qa/scenario/test/instance/any.rb @@ -15,6 +15,7 @@ module Gitlab specs.suite = 'Test::Instance::All' specs.release = QA::Release.new(edition_and_tag) specs.args = [address, *rspec_args] + specs.network = Runtime::Env.specs_network end end end -- GitLab From 178a53ce927cb4c7896c5c0b8b602b396fb13d53 Mon Sep 17 00:00:00 2001 From: Mark Lapierre Date: Wed, 2 Aug 2023 09:52:00 +1000 Subject: [PATCH 3/4] Override gitlab-org/gitlab CI --- .gitlab-ci.yml | 57 +++++++++++++++++------------------ .gitlab/ci/test.gitlab-ci.yml | 54 +++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 30 deletions(-) create mode 100644 .gitlab/ci/test.gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 94a9f276..92d1a141 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -90,34 +90,34 @@ cache-gems: changes: - Gemfile.lock -danger-review: - image: ${CI_REGISTRY}/gitlab-org/gitlab-build-images/debian-bullseye-ruby-${RUBY_VERSION}:bundler-2.4 - stage: check - needs: - - job: cache-gems - optional: true +# danger-review: +# image: ${CI_REGISTRY}/gitlab-org/gitlab-build-images/debian-bullseye-ruby-${RUBY_VERSION}:bundler-2.4 +# stage: check +# needs: +# - job: cache-gems +# optional: true -rubocop: - stage: check - needs: - - job: cache-gems - optional: true - script: - - bundle exec rubocop --color +# rubocop: +# stage: check +# needs: +# - job: cache-gems +# optional: true +# script: +# - bundle exec rubocop --color -rspec: - stage: test - needs: - - job: cache-gems - optional: true - coverage: /LOC \((\d{1,3}\.\d{1,2})\%\)/ - script: - - bundle exec rspec --force-color - artifacts: - reports: - coverage_report: - coverage_format: cobertura - path: coverage/coverage.xml +# rspec: +# stage: test +# needs: +# - job: cache-gems +# optional: true +# coverage: /LOC \((\d{1,3}\.\d{1,2})\%\)/ +# script: +# - bundle exec rspec --force-color +# artifacts: +# reports: +# coverage_report: +# coverage_format: cobertura +# path: coverage/coverage.xml package-and-test: stage: qa @@ -142,8 +142,5 @@ package-and-test: forward: yaml_variables: true pipeline_variables: true - include: - - project: gitlab-org/gitlab - ref: ml-test-streaming-events-test-last - file: .gitlab/ci/package-and-test/main.gitlab-ci.yml + include: .gitlab/ci/test.gitlab-ci.yml when: always diff --git a/.gitlab/ci/test.gitlab-ci.yml b/.gitlab/ci/test.gitlab-ci.yml new file mode 100644 index 00000000..5f9a9c09 --- /dev/null +++ b/.gitlab/ci/test.gitlab-ci.yml @@ -0,0 +1,54 @@ +include: + - project: gitlab-org/gitlab + ref: ml-test-streaming-events-test-last + file: .gitlab/ci/package-and-test/main.gitlab-ci.yml + - project: gitlab-org/gitlab + ref: ml-test-streaming-events-test-last + file: .gitlab/ci/qa-common/main.gitlab-ci.yml + +.end-with-test: + script: + - export QA_COMMAND="$BUNDLE_PREFIX gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} $RELEASE --no-teardown -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS" + - echo "Running - '$QA_COMMAND'" + - eval "$QA_COMMAND" + - export QA_TESTS="qa/specs/features/ee/api/10_govern/instance_audit_event_streaming_spec.rb" + - export NO_KNAPSACK="true" + - unset KNAPSACK_REPORT_PATH + - unset KNAPSACK_TEST_FILE_PATTERN + - unset KNAPSACK_TEST_DIR + - export container=$(docker container ls --filter 'name=gitlab*' --format "{{.Names}}") + - echo $container + - export QA_COMMAND="$BUNDLE_PREFIX gitlab-qa Test::Instance::Any $RELEASE http://$container.test $GITLAB_QA_OPTS -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS" + - echo "Running - '$QA_COMMAND'" + - eval "$QA_COMMAND" + - docker stop $(docker ps -a -q) + +instance: + extends: + - .parallel + - .qa + - .end-with-test + variables: + QA_SCENARIO: Test::Instance::Image + QA_RSPEC_TAGS: --order defined + +decomposition-single-db: + extends: + - .qa + - .parallel + - .end-with-test + variables: + QA_SCENARIO: Test::Instance::Image + GITLAB_QA_OPTS: --omnibus-config decomposition_single_db $EXTRA_GITLAB_QA_OPTS + QA_RSPEC_TAGS: --order defined + +decomposition-multiple-db: + extends: + - .qa + - .parallel + - .end-with-test + variables: + QA_SCENARIO: Test::Instance::Image + GITLAB_ALLOW_SEPARATE_CI_DATABASE: "true" + GITLAB_QA_OPTS: --omnibus-config decomposition_multiple_db $EXTRA_GITLAB_QA_OPTS + QA_RSPEC_TAGS: --order defined -- GitLab From e28b5edea135323e64222d84005c73887f41952c Mon Sep 17 00:00:00 2001 From: Mark Lapierre Date: Wed, 2 Aug 2023 10:20:57 +1000 Subject: [PATCH 4/4] Allow random order --- .gitlab/ci/test.gitlab-ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitlab/ci/test.gitlab-ci.yml b/.gitlab/ci/test.gitlab-ci.yml index 5f9a9c09..4c4d2bf9 100644 --- a/.gitlab/ci/test.gitlab-ci.yml +++ b/.gitlab/ci/test.gitlab-ci.yml @@ -30,7 +30,6 @@ instance: - .end-with-test variables: QA_SCENARIO: Test::Instance::Image - QA_RSPEC_TAGS: --order defined decomposition-single-db: extends: @@ -40,7 +39,6 @@ decomposition-single-db: variables: QA_SCENARIO: Test::Instance::Image GITLAB_QA_OPTS: --omnibus-config decomposition_single_db $EXTRA_GITLAB_QA_OPTS - QA_RSPEC_TAGS: --order defined decomposition-multiple-db: extends: @@ -51,4 +49,3 @@ decomposition-multiple-db: QA_SCENARIO: Test::Instance::Image GITLAB_ALLOW_SEPARATE_CI_DATABASE: "true" GITLAB_QA_OPTS: --omnibus-config decomposition_multiple_db $EXTRA_GITLAB_QA_OPTS - QA_RSPEC_TAGS: --order defined -- GitLab