Showing content from https://gitlab.com/gitlab-org/gitlab-qa/-/merge_requests/276.patch below:
From 0042c39c484091f6b973bbfd3cbc4769e53c52e8 Mon Sep 17 00:00:00 2001 From: ddavison Date: Tue, 3 Sep 2019 15:29:15 -0700 Subject: [PATCH 1/7] Remove fast-fail for gcloud environment The future of K8s testing on gitlab-qa does not solely rely on gcloud. --- lib/gitlab/qa/runtime/env.rb | 6 ------ lib/gitlab/qa/scenario/test/integration/kubernetes.rb | 2 -- 2 files changed, 8 deletions(-) diff --git a/lib/gitlab/qa/runtime/env.rb b/lib/gitlab/qa/runtime/env.rb index dec03e2d9..4a30b78b9 100644 --- a/lib/gitlab/qa/runtime/env.rb +++ b/lib/gitlab/qa/runtime/env.rb @@ -130,12 +130,6 @@ module Gitlab end end - def require_kubernetes_environment! - %w[GCLOUD_ACCOUNT_EMAIL GCLOUD_ACCOUNT_KEY CLOUDSDK_CORE_PROJECT GCLOUD_REGION].each do |env_key| - raise ArgumentError, "Environment variable #{env_key} must be set to run kubernetes specs" unless ENV.key?(env_key) - end - end - def skip_pull? (ENV['QA_SKIP_PULL'] =~ /^(false|no|0)$/i) != 0 end diff --git a/lib/gitlab/qa/scenario/test/integration/kubernetes.rb b/lib/gitlab/qa/scenario/test/integration/kubernetes.rb index e6443715d..60e21b3ab 100644 --- a/lib/gitlab/qa/scenario/test/integration/kubernetes.rb +++ b/lib/gitlab/qa/scenario/test/integration/kubernetes.rb @@ -8,8 +8,6 @@ module Gitlab class Kubernetes < Scenario::Template # rubocop:disable Metrics/AbcSize def perform(release, *rspec_args) - Runtime::Env.require_kubernetes_environment! - Component::Gitlab.perform do |gitlab| gitlab.release = release gitlab.network = 'test' -- GitLab From 88276b2f222ad1081136ab66436a6356bf396f81 Mon Sep 17 00:00:00 2001 From: ddavison Date: Thu, 10 Oct 2019 12:38:35 -0700 Subject: [PATCH 2/7] Add documentation for running Kubernetes tests against local GDK setup Up version Change default specs network to bridge (this only applies when running locally since the network is set to "test" in all other cases) --- docs/run_qa_against_gdk.md | 34 +++++++++++++++++++++++++++++++- lib/gitlab/qa/component/specs.rb | 2 +- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/docs/run_qa_against_gdk.md b/docs/run_qa_against_gdk.md index 182b2d3af..7f8a85dff 100644 --- a/docs/run_qa_against_gdk.md +++ b/docs/run_qa_against_gdk.md @@ -47,7 +47,38 @@ $ bundle exec bin/qa QA::EE::Scenario::Test::Geo --primary-address http://localh $ CHROME_HEADLESS=0 bundle exec bin/qa QA::EE::Scenario::Test::Geo --primary-address http://localhost:3001 --secondary-address http://localhost:3002 --primary-name primary --secondary-name secondary --without-setup ``` -### QA Tool support on macOS +## Run Kubernetes QA tests against your GDK setup + +**Prerequisites**: +To run the Kubernetes QA tests locally from your machine, +you must have access to the [QA Tunnel] and follow the instructions +[found here](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc%2Fhowto%2Fauto_devops.md) +(employees only) + +If you have [k3d] installed on your local machine - + +```bash +# from the gitlab/qa directory... +$ bundle exec bin/qa Test::Integration::Kubernetes https:// .qa-tunnel.gitlab.info -- qa/specs/features/browser_ui/7_configure/auto_devops +``` + +If you do not have [k3d] installed and would like to run it orchestrated, [see Orchestrated](#orchestrated) + +### Orchestrated + +1. If you are making local changes to the tests, build a QA image + +```bash +$ docker build -t gitlab/gitlab-ce-qa:your-custom-tag --file ./qa/Dockerfile ./ +``` + +2. From the [`gitlab-qa`](https://gitlab.com/gitlab-org/gitlab-qa) project, run: + +```bash +$ exe/gitlab-qa Test::Instance::Any gitlab/gitlab-ce-qa:your-custom-tag https:// .qa-tunnel.gitlab.info -- qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb --tag kubernetes +``` + +## QA Tool support on macOS Most of our development for GitLab is done on macOS. This brings some challenges as Docker on macOS doesn't have feature parity with it's Linux conterpart. @@ -148,6 +179,7 @@ You should be able to use your navigator and point it to `http://gitlab-primary. [Docker bridge issue]: https://github.com/moby/moby/issues/22753#issuecomment-253534261 [dnsdock]: https://github.com/aacebedo/dnsdock [Git protocol]: https://docs.gitlab.com/ee/administration/git_protocol.html#doc-nav +[k3d]: https://github.com/rancher/k3d ---- diff --git a/lib/gitlab/qa/component/specs.rb b/lib/gitlab/qa/component/specs.rb index 44e8a8305..85df6113e 100644 --- a/lib/gitlab/qa/component/specs.rb +++ b/lib/gitlab/qa/component/specs.rb @@ -34,7 +34,7 @@ module Gitlab name = "#{release.project_name}-qa-#{SecureRandom.hex(4)}" @docker.run(release.qa_image, release.qa_tag, suite, *args) do |command| - command << "-t --rm --net=#{network || 'bridge'}" + command << "-t --rm --net=#{network || 'host'}" Runtime::Env.variables.each do |key, value| command.env(key, value) -- GitLab From b16e63129573155d3858d890d984454e49701d0c Mon Sep 17 00:00:00 2001 From: ddavison Date: Thu, 10 Oct 2019 12:59:00 -0700 Subject: [PATCH 3/7] Delete Metrics/AbcSize rubocop disable --- lib/gitlab/qa/scenario/test/integration/kubernetes.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/gitlab/qa/scenario/test/integration/kubernetes.rb b/lib/gitlab/qa/scenario/test/integration/kubernetes.rb index 60e21b3ab..95fd67192 100644 --- a/lib/gitlab/qa/scenario/test/integration/kubernetes.rb +++ b/lib/gitlab/qa/scenario/test/integration/kubernetes.rb @@ -6,7 +6,6 @@ module Gitlab module Test module Integration class Kubernetes < Scenario::Template - # rubocop:disable Metrics/AbcSize def perform(release, *rspec_args) Component::Gitlab.perform do |gitlab| gitlab.release = release @@ -45,7 +44,6 @@ module Gitlab end end end - # rubocop:enable Metrics/AbcSize end end end -- GitLab From 2e88467c81abb14db66bf2604a75f92c125e08ff Mon Sep 17 00:00:00 2001 From: ddavison Date: Thu, 17 Oct 2019 17:46:23 -0700 Subject: [PATCH 4/7] Pass in GITLAB_QA_K#D_HOSTNAME to the specs hostname --- lib/gitlab/qa/component/specs.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/gitlab/qa/component/specs.rb b/lib/gitlab/qa/component/specs.rb index 85df6113e..152bf15b2 100644 --- a/lib/gitlab/qa/component/specs.rb +++ b/lib/gitlab/qa/component/specs.rb @@ -31,15 +31,16 @@ module Gitlab puts "Running test suite `#{suite}` for #{release.project_name}" - name = "#{release.project_name}-qa-#{SecureRandom.hex(4)}" - @docker.run(release.qa_image, release.qa_tag, suite, *args) do |command| - command << "-t --rm --net=#{network || 'host'}" + command << "-t --rm --net=#{network || 'bridge'}" Runtime::Env.variables.each do |key, value| command.env(key, value) end + # set k3d hostname + command.env('GITLAB_QA_K3D_HOSTNAME', hostname) + command.volume('/var/run/docker.sock', '/var/run/docker.sock') command.volume(File.join(Runtime::Env.host_artifacts_dir, name), File.join(Docker::Volumes::QA_CONTAINER_WORKDIR, 'tmp')) @@ -50,6 +51,14 @@ module Gitlab command.name(name) end end + + def name + "#{release.project_name}-qa-#{SecureRandom.hex(4)}" + end + + def hostname + "#{name}.#{network}" + end end end end -- GitLab From 045277ecefad1c17ae7b79d54bc2e4a9dc9ffe51 Mon Sep 17 00:00:00 2001 From: ddavison Date: Tue, 22 Oct 2019 10:52:33 -0700 Subject: [PATCH 5/7] Update doc to include GITLAB_QA_K3D_HOSTNAME var --- docs/run_qa_against_gdk.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/run_qa_against_gdk.md b/docs/run_qa_against_gdk.md index 7f8a85dff..726515d45 100644 --- a/docs/run_qa_against_gdk.md +++ b/docs/run_qa_against_gdk.md @@ -59,8 +59,8 @@ If you have [k3d] installed on your local machine - ```bash # from the gitlab/qa directory... -$ bundle exec bin/qa Test::Integration::Kubernetes https:// .qa-tunnel.gitlab.info -- qa/specs/features/browser_ui/7_configure/auto_devops -``` +$ GITLAB_QA_K3D_HOSTNAME=127.0.0.1 bundle exec bin/qa Test::Integration::Kubernetes https:// .qa-tunnel.gitlab.info -- qa/specs/features/browser_ui/7_configure/ +``` If you do not have [k3d] installed and would like to run it orchestrated, [see Orchestrated](#orchestrated) -- GitLab From cb4464bae4e025999f3a1d37d0bdac3151dc9bb1 Mon Sep 17 00:00:00 2001 From: ddavison Date: Wed, 23 Oct 2019 15:48:37 -0700 Subject: [PATCH 6/7] Rename GITLAB_QA_K3D_HOSTNAME to QA_K3D_HOSTNAME Pass through QA_K3D_HOSTNAME --- lib/gitlab/qa/component/specs.rb | 6 ++++-- lib/gitlab/qa/runtime/env.rb | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/gitlab/qa/component/specs.rb b/lib/gitlab/qa/component/specs.rb index 152bf15b2..6b2302a4c 100644 --- a/lib/gitlab/qa/component/specs.rb +++ b/lib/gitlab/qa/component/specs.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'securerandom' module Gitlab @@ -38,8 +40,8 @@ module Gitlab command.env(key, value) end - # set k3d hostname - command.env('GITLAB_QA_K3D_HOSTNAME', hostname) + # set k3d hostname to listen on + command.env('QA_K3D_HOSTNAME', hostname) command.volume('/var/run/docker.sock', '/var/run/docker.sock') command.volume(File.join(Runtime::Env.host_artifacts_dir, name), File.join(Docker::Volumes::QA_CONTAINER_WORKDIR, 'tmp')) diff --git a/lib/gitlab/qa/runtime/env.rb b/lib/gitlab/qa/runtime/env.rb index 4a30b78b9..0adec49ea 100644 --- a/lib/gitlab/qa/runtime/env.rb +++ b/lib/gitlab/qa/runtime/env.rb @@ -39,6 +39,7 @@ module Gitlab 'QA_DEBUG' => :qa_debug, 'QA_LOG_PATH' => :qa_log_path, 'QA_CAN_TEST_GIT_PROTOCOL_V2' => :qa_can_test_git_protocol_v2, + 'QA_K3D_HOSTNAME' => :k3d_hostname, 'GITLAB_QA_USERNAME_1' => :gitlab_qa_username_1, 'GITLAB_QA_PASSWORD_1' => :gitlab_qa_password_1, 'GITLAB_QA_USERNAME_2' => :gitlab_qa_username_2, -- GitLab From fe159b5ee1d1c2cfd4c2b1345ea531517773e595 Mon Sep 17 00:00:00 2001 From: ddavison Date: Tue, 5 Nov 2019 09:57:42 -0800 Subject: [PATCH 7/7] Refactor GITLAB_QA_K3D_HOSTNAME in docs --- docs/run_qa_against_gdk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/run_qa_against_gdk.md b/docs/run_qa_against_gdk.md index 726515d45..43abf13a1 100644 --- a/docs/run_qa_against_gdk.md +++ b/docs/run_qa_against_gdk.md @@ -59,7 +59,7 @@ If you have [k3d] installed on your local machine - ```bash # from the gitlab/qa directory... -$ GITLAB_QA_K3D_HOSTNAME=127.0.0.1 bundle exec bin/qa Test::Integration::Kubernetes https:// .qa-tunnel.gitlab.info -- qa/specs/features/browser_ui/7_configure/ +$ QA_K3D_HOSTNAME=127.0.0.1 bundle exec bin/qa Test::Integration::Kubernetes https:// .qa-tunnel.gitlab.info -- qa/specs/features/browser_ui/7_configure/ ``` If you do not have [k3d] installed and would like to run it orchestrated, [see Orchestrated](#orchestrated) -- GitLab
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4