gitlab-qa 7.29.0 → 7.29.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d4ca3feba042298fe467133b5f576653b553af61ac01a0b72a1a970917e3711
4
- data.tar.gz: 61ee29dbe4355bcbc18d8e164b97f1453c461419fcf6bd70543a659e5029d333
3
+ metadata.gz: 6f3a8d250f26a5899d776475ac349829311045b51aeed7b73f1a40fc41cd23dc
4
+ data.tar.gz: 2258303729505a302fe0a6d05b57f5deee6efe21f0d7cbfb2542e92febfe2dc7
5
5
  SHA512:
6
- metadata.gz: 5ddff780b5188c489bec89ce0b475096ac707f9e2e5138cc400efeef9fbd576b4c5bebc77f43af207109503e08e1c1efaf2813e3666bd9d88d5807f7c9691891
7
- data.tar.gz: 34b7eacbd20c81f264aaf478f35e9ed78d5c7e185b18178bd55fa1c5fc37b0053f54bd49027d994cf91d6d69120c3371fdb818727419c17ef10ea7f373a4c91d
6
+ metadata.gz: 2ad81f0b8d7bcb59ff76963f0463ae2d221be28b262455c22e6ee11ad91a9c6b768291639ed25b9ff756c9b319566f4aa596281ca2c09d470a5a1374174f3929
7
+ data.tar.gz: 6e5a9601b50167f4cae9c87fe1415b1a6a740c855e56580cc553559d481842f6ed9feced7760a0403bb7993ef5ba7e11c1fd5723d2812a06227d1a64b87aefd1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-qa (7.29.0)
4
+ gitlab-qa (7.29.1)
5
5
  activesupport (~> 6.1)
6
6
  gitlab (~> 4.18.0)
7
7
  http (~> 5.0)
@@ -219,7 +219,7 @@ GEM
219
219
  concurrent-ruby (~> 1.0)
220
220
  unf (0.1.4)
221
221
  unf_ext
222
- unf_ext (0.0.8.1)
222
+ unf_ext (0.0.8.2)
223
223
  unicode-display_width (1.8.0)
224
224
  webmock (3.7.0)
225
225
  addressable (>= 2.3.6)
@@ -712,6 +712,23 @@ in the GitLab project).
712
712
  This is used to retrieve the version that staging is currently running.
713
713
  This can be found in the shared 1Password vault.
714
714
 
715
+ - `GITLAB_USERNAME`: An existing user.
716
+
717
+ - `GITLAB_PASSWORD`: The user's password.
718
+
719
+ **Required by specific tests:**
720
+
721
+ - `QA_PRAEFECT_REPOSITORY_STORAGE`: The name of a Gitaly Cluster storage.
722
+
723
+ - `GITLAB_ADMIN_USERNAME`: An existing user with administrator access. Required by tests that set feature flags or
724
+ perform other admin actions.
725
+
726
+ - `GITLAB_ADMIN_PASSWORD`: The administrator user's password.
727
+
728
+ - `GITLAB_QA_USERNAME_X`: The username of a pre-generated test user, where `X` is `1` to `6`.
729
+
730
+ - `GITLAB_QA_PASSWORD_X`: The pre-generated test user's password.
731
+
715
732
  **Optional environment variables:**
716
733
 
717
734
  - `GITLAB_QA_DEV_ACCESS_TOKEN`: A valid personal access token for the
@@ -719,17 +736,24 @@ in the GitLab project).
719
736
  This is used to pull the QA Docker image from the Omnibus GitLab `dev` Container Registry.
720
737
  If the variable isn't present, the QA image from Docker Hub will be used.
721
738
  This can be found in the shared 1Password vault.
739
+ Please note that this variable must be provided when you need to be sure the version of the
740
+ tests matches the version of GitLab on Staging. If the version from Docker Hub is used it might not include changes deployed to Staging very recently.
722
741
 
723
- Example:
742
+ An example of how to run the smoke tests:
724
743
 
725
744
  ```
726
- $ export GITLAB_QA_USER_AGENT="$GITLAB_QA_USER_AGENT"
727
- $ export GITLAB_QA_ACCESS_TOKEN=your_api_access_token
728
- $ export GITLAB_QA_DEV_ACCESS_TOKEN=your_dev_registry_access_token
745
+ $ export GITLAB_QA_USER_AGENT="<value from 1Password>"
746
+ $ export GITLAB_QA_ACCESS_TOKEN="<value from 1Password>"
747
+ $ export GITLAB_QA_DEV_ACCESS_TOKEN="<value from 1Password>"
729
748
  $ export GITLAB_USERNAME="gitlab-qa"
730
- $ export GITLAB_PASSWORD="$GITLAB_QA_PASSWORD"
749
+ $ export GITLAB_PASSWORD="<value from 1Password>"
750
+ $ export GITLAB_ADMIN_USERNAME="<value from 1Password>"
751
+ $ export GITLAB_ADMIN_PASSWORD="<value from 1Password>"
752
+ $ export GITLAB_QA_USERNAME_1="gitlab-qa-user1"
753
+ $ export GITLAB_QA_PASSWORD_1="<value from 1Password>"
754
+ $ export QA_PRAEFECT_REPOSITORY_STORAGE="nfs-file22"
731
755
 
732
- $ gitlab-qa Test::Instance::Staging
756
+ $ gitlab-qa Test::Instance::Staging -- --tag smoke
733
757
  ```
734
758
 
735
759
  ### `Test::Instance::StagingRef`
@@ -828,6 +852,52 @@ by setting `QA_COOKIES=gitlab_canary=true`. This adds a cookie
828
852
  to all web requests which will result in them being routed
829
853
  to the canary fleet.
830
854
 
855
+ **Required environment variables:**
856
+
857
+ - `GITLAB_QA_USER_AGENT`: The browser user-agent to use instead of the default Chrome user-agent.
858
+ This is needed for the automated tests to bypass the WAF
859
+
860
+ - `GITLAB_QA_ACCESS_TOKEN`: A valid personal access token with the `api` scope.
861
+ This is used to retrieve the version that staging is currently running.
862
+ This can be found in the shared 1Password vault.
863
+
864
+ - `GITLAB_USERNAME`: An existing user.
865
+
866
+ - `GITLAB_PASSWORD`: The user's password.
867
+
868
+ **Required by specific tests:**
869
+
870
+ - `GITLAB_QA_USERNAME_X`: The username of a pre-generated test user, where `X` is `1` to `6`.
871
+
872
+ - `GITLAB_QA_PASSWORD_X`: The pre-generated test user's password.
873
+
874
+ **Optional environment variables:**
875
+
876
+ - `GITLAB_QA_DEV_ACCESS_TOKEN`: A valid personal access token for the
877
+ `gitlab-qa-bot` on `dev.gitlab.org` with the `registry` scope.
878
+ This is used to pull the QA Docker image from the Omnibus GitLab `dev` Container Registry.
879
+ If the variable isn't present, the QA image from Docker Hub will be used.
880
+ This can be found in the shared 1Password vault.
881
+ Please note that this variable should be provided when you need to be sure the version of the
882
+ tests matches the version of GitLab on Staging. If the version from Docker Hub is used it might not include changes deployed to Staging very recently.
883
+
884
+ An example of how to run the smoke tests:
885
+
886
+ ```
887
+ $ export GITLAB_QA_USER_AGENT="<value from 1Password>"
888
+ $ export GITLAB_QA_ACCESS_TOKEN="<value from 1Password>"
889
+ $ export GITLAB_QA_DEV_ACCESS_TOKEN="<value from 1Password>"
890
+ $ export GITLAB_USERNAME="gitlab-qa"
891
+ $ export GITLAB_PASSWORD="<value from 1Password>"
892
+ $ export GITLAB_QA_USERNAME_1="gitlab-qa-user1"
893
+ $ export GITLAB_QA_PASSWORD_1="<value from 1Password>"
894
+ $ export QA_CAN_TEST_GIT_PROTOCOL_V2="false"
895
+ $ export QA_CAN_TEST_ADMIN_FEATURES="false"
896
+ $ export QA_CAN_TEST_PRAEFECT="false"
897
+
898
+ $ gitlab-qa Test::Instance::Production -- --tag smoke
899
+ ```
900
+
831
901
  ### `Test::Instance::Preprod`
832
902
 
833
903
  This scenario functions the same as `Test::Instance::Staging`
@@ -11,7 +11,7 @@ module Gitlab
11
11
  attr_accessor :suite, :release, :network, :args, :volumes, :env, :runner_network, :hostname
12
12
 
13
13
  def initialize
14
- @docker = Docker::Engine.new
14
+ @docker = Docker::Engine.new(stream_output: true) # stream test output directly instead of through logger
15
15
  @volumes = {}
16
16
  @env = {}
17
17
  end
@@ -2,11 +2,17 @@ module Gitlab
2
2
  module QA
3
3
  module Docker
4
4
  class Command
5
- attr_reader :args
5
+ attr_reader :args, :stream_output
6
6
 
7
- def initialize(cmd = nil, mask_secrets: nil)
7
+ # Shell command
8
+ #
9
+ # @param [<String, Array>] cmd
10
+ # @param [<String, Array>] mask_secrets
11
+ # @param [Boolean] stream_output stream command output to stdout directly instead of logger
12
+ def initialize(cmd = nil, mask_secrets: nil, stream_output: false)
8
13
  @args = Array(cmd)
9
14
  @mask_secrets = Array(mask_secrets)
15
+ @stream_output = stream_output
10
16
  end
11
17
 
12
18
  def <<(*args)
@@ -7,6 +7,12 @@ module Gitlab
7
7
  DOCKER_HOST = ENV['DOCKER_HOST'] || 'http://localhost'
8
8
  PRIVILEGED_COMMANDS = [/^iptables.*/].freeze
9
9
 
10
+ attr_reader :stream_output
11
+
12
+ def initialize(stream_output: false)
13
+ @stream_output = stream_output
14
+ end
15
+
10
16
  def hostname
11
17
  URI(DOCKER_HOST).host
12
18
  end
@@ -25,7 +31,7 @@ module Gitlab
25
31
  end
26
32
 
27
33
  def run(image:, tag: nil, args: [])
28
- Docker::Command.new('run').tap do |command|
34
+ Docker::Command.new('run', stream_output: stream_output).tap do |command|
29
35
  yield command if block_given?
30
36
 
31
37
  command << full_image_name(image, tag)
@@ -17,25 +17,33 @@ module Gitlab
17
17
  @logger = Runtime::Logger.logger
18
18
  end
19
19
 
20
+ attr_reader :command, :logger
21
+
20
22
  def execute! # rubocop:disable Metrics/AbcSize
21
23
  raise StatusError, 'Command already executed' if @output.any?
22
24
 
23
- @logger.info("Docker shell command: `#{@command.mask_secrets}`".cyan)
25
+ logger.info("Docker shell command: `#{@command.mask_secrets.cyan}`")
24
26
 
25
27
  Open3.popen2e(@command.to_s) do |_in, out, wait|
26
28
  out.each do |line|
27
29
  @output.push(line)
28
- print "." unless Runtime::Env.ci # indicate progress for local run
30
+
31
+ if stream_progress
32
+ print "."
33
+ elsif command.stream_output
34
+ puts line
35
+ end
36
+
29
37
  yield line, wait if block_given?
30
38
  end
31
- puts unless Runtime::Env.ci # add newline after progress dots
39
+ puts if stream_progress
32
40
 
33
41
  if wait.value.exited? && wait.value.exitstatus.nonzero?
34
- @logger.error("Docker shell command output:\n#{output}")
35
- raise StatusError, "Docker command `#{@command.mask_secrets}` failed! ✘"
42
+ logger.error("Docker shell command output:\n#{output}") unless command.stream_output
43
+ raise StatusError, "Docker command `#{@command.mask_secrets[0..100]}` failed! ✘"
36
44
  end
37
45
 
38
- @logger.debug("Docker shell command output:\n#{output}") unless output.empty?
46
+ logger.debug("Docker shell command output:\n#{output}") unless command.stream_output || output.empty?
39
47
  end
40
48
 
41
49
  output
@@ -43,6 +51,13 @@ module Gitlab
43
51
 
44
52
  private
45
53
 
54
+ # Stream only command execution progress and log output when command finished
55
+ #
56
+ # @return [Boolean]
57
+ def stream_progress
58
+ !(Runtime::Env.ci || command.stream_output)
59
+ end
60
+
46
61
  def output
47
62
  @output.join.chomp
48
63
  end
@@ -12,13 +12,10 @@ module Gitlab
12
12
 
13
13
  def self.logger
14
14
  @logger ||= begin
15
- log_path = Runtime::Env.log_path
16
- FileUtils.mkdir_p(log_path) unless File.exist?(log_path)
15
+ log_path = Env.log_path
16
+ ::FileUtils.mkdir_p(log_path) unless File.exist?(log_path)
17
17
 
18
- QA::TestLogger.logger(
19
- level: Runtime::Env.debug? ? "DEBUG" : Runtime::Env.log_level,
20
- path: log_path
21
- )
18
+ TestLogger.logger(level: Env.debug? ? "DEBUG" : Env.log_level, path: log_path)
22
19
  end
23
20
  end
24
21
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '7.29.0'
5
+ VERSION = '7.29.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-qa
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.29.0
4
+ version: 7.29.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-25 00:00:00.000000000 Z
11
+ date: 2022-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control