gitlab-qa 14.10.0 → 14.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab-ci.yml +5 -7
  3. data/.rubocop_todo.yml +0 -1
  4. data/Gemfile.lock +1 -1
  5. data/docs/what_tests_can_be_run.md +6 -22
  6. data/lib/gitlab/qa/component/ai_gateway.rb +71 -1
  7. data/lib/gitlab/qa/component/chaos.rb +1 -1
  8. data/lib/gitlab/qa/component/gitaly_cluster.rb +1 -1
  9. data/lib/gitlab/qa/component/gitlab.rb +1 -0
  10. data/lib/gitlab/qa/runner.rb +0 -13
  11. data/lib/gitlab/qa/runtime/env.rb +124 -119
  12. data/lib/gitlab/qa/runtime/omnibus_configurations/object_storage.rb +1 -1
  13. data/lib/gitlab/qa/scenario/test/instance/airgapped.rb +1 -1
  14. data/lib/gitlab/qa/scenario/test/instance/image.rb +1 -1
  15. data/lib/gitlab/qa/scenario/test/instance/relative_url.rb +1 -1
  16. data/lib/gitlab/qa/scenario/test/instance/repository_storage.rb +1 -1
  17. data/lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb +2 -1
  18. data/lib/gitlab/qa/scenario/test/integration/client_ssl.rb +1 -1
  19. data/lib/gitlab/qa/scenario/test/integration/elasticsearch.rb +2 -2
  20. data/lib/gitlab/qa/scenario/test/integration/gitlab_pages.rb +1 -1
  21. data/lib/gitlab/qa/scenario/test/integration/import.rb +1 -1
  22. data/lib/gitlab/qa/scenario/test/integration/integrations.rb +1 -1
  23. data/lib/gitlab/qa/scenario/test/integration/jira.rb +1 -1
  24. data/lib/gitlab/qa/scenario/test/integration/ldap.rb +3 -3
  25. data/lib/gitlab/qa/scenario/test/integration/mattermost.rb +1 -1
  26. data/lib/gitlab/qa/scenario/test/integration/metrics.rb +1 -1
  27. data/lib/gitlab/qa/scenario/test/integration/mtls.rb +1 -1
  28. data/lib/gitlab/qa/scenario/test/integration/opensearch.rb +2 -2
  29. data/lib/gitlab/qa/scenario/test/integration/registry.rb +1 -1
  30. data/lib/gitlab/qa/scenario/test/integration/registry_tls.rb +1 -1
  31. data/lib/gitlab/qa/scenario/test/integration/registry_with_cdn.rb +2 -2
  32. data/lib/gitlab/qa/scenario/test/integration/saml.rb +3 -3
  33. data/lib/gitlab/qa/scenario/test/integration/service_ping_disabled.rb +1 -1
  34. data/lib/gitlab/qa/scenario/test/integration/smtp.rb +1 -1
  35. data/lib/gitlab/qa/scenario/test/integration/suggested_reviewer.rb +1 -1
  36. data/lib/gitlab/qa/scenario/test/omnibus/update_from_previous.rb +25 -7
  37. data/lib/gitlab/qa/support/gitlab_upgrade_path.rb +2 -2
  38. data/lib/gitlab/qa/version.rb +1 -1
  39. data/rubocop/cop/gitlab/dangerous_interpolation.rb +0 -1
  40. metadata +2 -5
  41. data/lib/gitlab/qa/component/telegraf.rb +0 -175
  42. data/lib/gitlab/qa/scenario/test/instance/staging_geo.rb +0 -32
  43. data/lib/gitlab/qa/scenario/test/sanity/version.rb +0 -93
@@ -10,7 +10,7 @@ module Gitlab
10
10
  Component::Gitlab.perform do |gitlab|
11
11
  gitlab.release = QA::Release.new(release)
12
12
  gitlab.name = 'gitlab'
13
- gitlab.network = 'test'
13
+ gitlab.network = Runtime::Env.docker_network
14
14
  gitlab.omnibus_configuration << gitlab_omnibus_configuration
15
15
  cluster = Component::GitalyCluster.perform do |c|
16
16
  c.config = Component::GitalyCluster::GitalyClusterConfig.new(gitlab_name: 'gitlab')
@@ -10,7 +10,7 @@ module Gitlab
10
10
  SETUP_DEST_PATH = '/tmp/setup-scripts'
11
11
 
12
12
  def initialize
13
- @network = 'test'
13
+ @network = Runtime::Env.docker_network
14
14
  @ai_gateway_name = 'ai-gateway'
15
15
  @ai_gateway_hostname = "#{@ai_gateway_name}.#{@network}"
16
16
  @ai_gateway_port = 5000
@@ -42,6 +42,7 @@ module Gitlab
42
42
  gitlab.network = @network
43
43
 
44
44
  gitlab.omnibus_gitlab_rails_env['AI_GATEWAY_URL'] = "http://#{@ai_gateway_hostname}:#{@ai_gateway_port}"
45
+ gitlab.omnibus_gitlab_rails_env['LLM_DEBUG'] = 'true'
45
46
 
46
47
  gitlab.set_ee_activation_code if @use_cloud_license
47
48
  end
@@ -9,7 +9,7 @@ module Gitlab
9
9
  def initialize
10
10
  @gitlab_name = 'gitlab'
11
11
  @spec_suite = 'Test::Instance::All'
12
- @network = 'test'
12
+ @network = Runtime::Env.docker_network
13
13
  @env = {}
14
14
  @tag = 'client_ssl'
15
15
  end
@@ -26,7 +26,7 @@ module Gitlab
26
26
  setup_elasticsearch_on gitlab
27
27
 
28
28
  Component::Elasticsearch.perform do |elastic|
29
- elastic.network = 'test'
29
+ elastic.network = Runtime::Env.docker_network
30
30
  elastic.instance do
31
31
  gitlab.instance do
32
32
  Runtime::Logger.info("Running #{spec_suite} specs!")
@@ -49,7 +49,7 @@ module Gitlab
49
49
 
50
50
  def setup_elasticsearch_on(instance)
51
51
  instance.name = gitlab_name
52
- instance.network = 'test'
52
+ instance.network = Runtime::Env.docker_network
53
53
  instance.elastic_url = 'http://elastic68:9200'
54
54
  instance.exec_commands = empty_index
55
55
  end
@@ -8,7 +8,7 @@ module Gitlab
8
8
  class GitlabPages < Scenario::Template
9
9
  def initialize
10
10
  @gitlab_name = 'gitlab-pages'
11
- @network = 'test'
11
+ @network = Runtime::Env.docker_network
12
12
  @pages_host = 'gitlab-pages.test'
13
13
  @pages_sandbox_name = 'gitlab-qa-sandbox-group-pages'
14
14
  @tag = 'gitlab_pages'
@@ -14,7 +14,7 @@ module Gitlab
14
14
  #
15
15
  class Import < Scenario::Template
16
16
  def initialize
17
- @network = "test"
17
+ @network = Runtime::Env.docker_network
18
18
  @source_gitlab = Component::Gitlab.new.tap { |gitlab| gitlab.network = @network }
19
19
  @target_gitlab = Component::Gitlab.new.tap { |gitlab| gitlab.network = @network }
20
20
  @mock_server = Component::MockServer.new.tap do |server|
@@ -9,7 +9,7 @@ module Gitlab
9
9
  def perform(release, *rspec_args)
10
10
  Component::Gitlab.perform do |gitlab|
11
11
  gitlab.release = QA::Release.new(release)
12
- gitlab.network = 'test'
12
+ gitlab.network = Runtime::Env.docker_network
13
13
  gitlab.name = 'gitlab-integrations'
14
14
  gitlab.instance do
15
15
  Component::Specs.perform do |specs|
@@ -9,7 +9,7 @@ module Gitlab
9
9
  def perform(release, *rspec_args)
10
10
  Component::Gitlab.perform do |gitlab|
11
11
  gitlab.release = QA::Release.new(release)
12
- gitlab.network = 'test'
12
+ gitlab.network = Runtime::Env.docker_network
13
13
  gitlab.name = 'gitlab-jira'
14
14
 
15
15
  Component::Jira.perform do |jira|
@@ -21,7 +21,7 @@ module Gitlab
21
21
 
22
22
  def initialize
23
23
  @ldap_name = 'ldap-server'
24
- @network = 'test'
24
+ @network = Runtime::Env.docker_network
25
25
  end
26
26
 
27
27
  def configure_omnibus(gitlab)
@@ -69,7 +69,7 @@ module Gitlab
69
69
  def orchestrate_ldap(&block)
70
70
  Component::LDAP.perform do |ldap|
71
71
  ldap.name = 'ldap-server'
72
- ldap.network = 'test'
72
+ ldap.network = Runtime::Env.docker_network
73
73
  ldap.set_gitlab_credentials
74
74
  ldap.tls = tls
75
75
 
@@ -81,7 +81,7 @@ module Gitlab
81
81
  Component::Gitlab.perform do |gitlab|
82
82
  gitlab.release = release
83
83
  gitlab.name = gitlab_name
84
- gitlab.network = 'test'
84
+ gitlab.network = Runtime::Env.docker_network
85
85
  gitlab.tls = tls
86
86
  configure_omnibus(gitlab)
87
87
 
@@ -9,7 +9,7 @@ module Gitlab
9
9
  def perform(release, *rspec_args)
10
10
  Component::Gitlab.perform do |gitlab|
11
11
  gitlab.release = release
12
- gitlab.network = 'test'
12
+ gitlab.network = Runtime::Env.docker_network
13
13
 
14
14
  mattermost_hostname = "mattermost.#{gitlab.network}"
15
15
  mattermost_external_url = "http://#{mattermost_hostname}"
@@ -12,7 +12,7 @@ module Gitlab
12
12
  def perform(release, *rspec_args)
13
13
  Component::Gitlab.perform do |gitlab|
14
14
  gitlab.release = release
15
- gitlab.network = 'test'
15
+ gitlab.network = Runtime::Env.docker_network
16
16
  gitlab.name = 'gitlab'
17
17
  gitlab.ports = [PUMA_METRICS_SERVER_PORT, SIDEKIQ_METRICS_SERVER_PORT]
18
18
 
@@ -10,7 +10,7 @@ module Gitlab
10
10
  @gitlab_name = 'gitlab'
11
11
  @gitaly_name = 'gitaly'
12
12
  @spec_suite = 'Test::Instance::All'
13
- @network = 'test'
13
+ @network = Runtime::Env.docker_network
14
14
  @env = {}
15
15
  @tag = 'mtls'
16
16
  end
@@ -27,7 +27,7 @@ module Gitlab
27
27
  setup_opensearch_on gitlab
28
28
 
29
29
  Component::Opensearch.perform do |opensearch|
30
- opensearch.network = 'test'
30
+ opensearch.network = Runtime::Env.docker_network
31
31
  opensearch.instance do
32
32
  gitlab.instance do
33
33
  Runtime::Logger.info("Running #{spec_suite} specs!")
@@ -50,7 +50,7 @@ module Gitlab
50
50
 
51
51
  def setup_opensearch_on(instance)
52
52
  instance.name = gitlab_name
53
- instance.network = 'test'
53
+ instance.network = Runtime::Env.docker_network
54
54
  instance.elastic_url = "http://elastic68:9200"
55
55
  instance.exec_commands = empty_index
56
56
  end
@@ -9,7 +9,7 @@ module Gitlab
9
9
  def perform(release, *rspec_args)
10
10
  Component::Gitlab.perform do |gitlab|
11
11
  gitlab.release = release
12
- gitlab.network = 'test'
12
+ gitlab.network = Runtime::Env.docker_network
13
13
  gitlab.name = 'gitlab'
14
14
 
15
15
  gitlab.omnibus_configuration << <<~OMNIBUS
@@ -9,7 +9,7 @@ module Gitlab
9
9
  def perform(release, *rspec_args)
10
10
  Component::Gitlab.perform do |gitlab|
11
11
  gitlab.release = release
12
- gitlab.network = 'test'
12
+ gitlab.network = Runtime::Env.docker_network
13
13
  gitlab.name = 'gitlab'
14
14
  gitlab.tls = true
15
15
 
@@ -11,9 +11,9 @@ module Gitlab
11
11
 
12
12
  Component::Gitlab.perform do |gitlab|
13
13
  gitlab.release = release
14
- gitlab.network = 'test'
14
+ gitlab.network = Runtime::Env.docker_network
15
15
  gitlab.name = 'gitlab'
16
- gitlab.seed_admin_token = false
16
+ gitlab.seed_admin_token = true
17
17
  sign_url_key_path = gitlab.create_key_file('GOOGLE_CDN_SIGNURL_KEY')
18
18
  cdn_gcloud_path = gitlab.create_key_file('GOOGLE_CDN_JSON_KEY')
19
19
 
@@ -18,19 +18,19 @@ module Gitlab
18
18
  # no-op
19
19
  end
20
20
 
21
- def perform(release, *rspec_args)
21
+ def perform(release, *rspec_args) # rubocop:disable Metrics/AbcSize
22
22
  release = QA::Release.new(release)
23
23
  before_perform(release)
24
24
 
25
25
  Component::Gitlab.perform do |gitlab|
26
26
  gitlab.release = release
27
- gitlab.network = 'test'
27
+ gitlab.network = Runtime::Env.docker_network
28
28
  gitlab.name = gitlab_name
29
29
  gitlab.set_accept_insecure_certs
30
30
 
31
31
  if saml_component
32
32
  Component::SAML.perform do |saml|
33
- saml.network = 'test'
33
+ saml.network = Runtime::Env.docker_network
34
34
  configure(gitlab, saml)
35
35
 
36
36
  saml.instance do
@@ -9,7 +9,7 @@ module Gitlab
9
9
  def perform(release, *rspec_args)
10
10
  Component::Gitlab.perform do |gitlab|
11
11
  gitlab.release = release
12
- gitlab.network = 'test'
12
+ gitlab.network = Runtime::Env.docker_network
13
13
 
14
14
  gitlab.omnibus_configuration << <<~OMNIBUS
15
15
  gitlab_rails['usage_ping_enabled'] = false;
@@ -28,7 +28,7 @@ module Gitlab
28
28
 
29
29
  Component::Gitlab.perform do |gitlab|
30
30
  gitlab.release = release
31
- gitlab.network = 'test'
31
+ gitlab.network = Runtime::Env.docker_network
32
32
  gitlab.name = gitlab_name
33
33
 
34
34
  Component::MailHog.perform do |mail_hog|
@@ -10,7 +10,7 @@ module Gitlab
10
10
 
11
11
  def initialize
12
12
  @spec_suite = 'Test::Instance::All'
13
- @network = 'test'
13
+ @network = Runtime::Env.docker_network
14
14
  @env = {}
15
15
  @tag = 'suggested_reviewer'
16
16
  @gitlab_name = 'gitlab-suggested-reviewer'
@@ -9,7 +9,7 @@ module Gitlab
9
9
  using Rainbow
10
10
 
11
11
  # Test update from N - 1 (major|minor|patch) version to current release
12
- # Run smoke test suite on previous release to populate some data in database before update
12
+ # Run health check (or smoke if below 17.1.0) test suite on previous release to populate some data in database before update
13
13
  #
14
14
  # @example
15
15
  # perform(gitlab-ee:dev-tag, 15.3.0-pre, major)
@@ -24,6 +24,7 @@ module Gitlab
24
24
  def perform(release, current_version, semver_component, from_edition = nil, *rspec_args)
25
25
  # When from_edition isn't actually passed but RSpec args arg passed with `-- rspec_args...`,
26
26
  # from_edition is wrongly set to `--`, so we fix that here.
27
+
27
28
  if from_edition == "--"
28
29
  rspec_args.prepend('--')
29
30
  from_edition = nil
@@ -46,15 +47,31 @@ module Gitlab
46
47
 
47
48
  attr_reader :current_release, :upgrade_path
48
49
 
50
+ # Extract version number from a string, for example: "gitlab/gitlab-ee:15.11.13-ee.0"
51
+ #
52
+ # @param [String] version_string version string to extract from
53
+ # @return [String] extracted version number
54
+ def extract_version(version_string)
55
+ QA::Release.new(version_string).tag.split('-').first
56
+ end
57
+
49
58
  # Perform update
50
59
  #
51
60
  # @param [Array] rspec_args
52
61
  # @return [void]
62
+ # rubocop:disable Metrics/AbcSize
53
63
  def update(rspec_args)
54
64
  Docker::Volumes.new.with_temporary_volumes do |volumes|
65
+ first_release_version = extract_version(upgrade_path.first.release)
66
+ seeding_suite_args = if Gem::Version.new(first_release_version) < Gem::Version.new("17.1.0")
67
+ ["--", "--tag", "smoke"]
68
+ else
69
+ ["--", "--tag", "health_check"]
70
+ end
71
+
55
72
  # deploy first release in upgrade path and run specs to populate db
56
73
  Runtime::Logger.info("Running the first release in upgrade path: #{upgrade_path.first}")
57
- run_gitlab(upgrade_path.first, volumes, ["--", "--tag", "smoke"])
74
+ run_gitlab(upgrade_path.first, volumes, seeding_suite_args)
58
75
 
59
76
  # deploy releases in upgrade path
60
77
  upgrade_path[1..].each do |release|
@@ -67,6 +84,7 @@ module Gitlab
67
84
  run_gitlab(current_release, volumes, rspec_args, skip_setup: true)
68
85
  end
69
86
  end
87
+ # rubocop:enable Metrics/AbcSize
70
88
 
71
89
  # Deploy gitlab instance and optionally run specs
72
90
  #
@@ -79,7 +97,7 @@ module Gitlab
79
97
  Component::Gitlab.perform do |gitlab|
80
98
  gitlab.release = release
81
99
  gitlab.volumes = volumes
82
- gitlab.network = 'test'
100
+ gitlab.network = Runtime::Env.docker_network
83
101
 
84
102
  if skip_setup
85
103
  gitlab.skip_server_hooks = true
@@ -100,8 +118,8 @@ module Gitlab
100
118
  # @param [Array] rspec_args
101
119
  # @return [void]
102
120
  def run_specs(gitlab, release, rspec_args) # rubocop:disable Metrics/AbcSize
103
- Runtime::Logger.info("Running smoke test to verify update and seed data in environment") unless upgrade_path.first != release
104
- Runtime::Logger.info("Running smoke test to verify update") unless current_release != release
121
+ Runtime::Logger.info("Running test suite to verify update and seed data in environment") unless upgrade_path.first != release
122
+ Runtime::Logger.info("Running test suite to verify update") unless current_release != release
105
123
 
106
124
  Component::Specs.perform do |specs|
107
125
  specs.release = release
@@ -119,11 +137,11 @@ module Gitlab
119
137
  end
120
138
  rescue Support::ShellCommand::StatusError => e
121
139
  if release == current_release # only fail on current release
122
- Runtime::Logger.error("Failed to run test suite after final upgrade to release '#{release}'")
140
+ Runtime::Logger.error("Failed to run health check after final upgrade to release '#{release}'")
123
141
  raise e
124
142
  end
125
143
 
126
- Runtime::Logger.warn("Test run for release '#{gitlab.release}' finished with errors!")
144
+ Runtime::Logger.warn("Health check verification for release '#{gitlab.release}' finished with errors!")
127
145
  end
128
146
 
129
147
  # Run specs on first release to populate database and release being tested
@@ -82,9 +82,9 @@ module Gitlab
82
82
  # @return [String]
83
83
  def upgrade_path_yml
84
84
  @upgrade_path_yml ||= begin
85
- logger.info("Fetching gitlab upgrade path from 'gitlab-com/support/toolbox/upgrade-path' project")
85
+ logger.info("Fetching gitlab upgrade path from 'gitlab.com/gitlab-org/gitlab' project")
86
86
  HttpRequest.make_http_request(
87
- url: "https://gitlab.com/gitlab-com/support/toolbox/upgrade-path/-/raw/main/upgrade-path.yml"
87
+ url: "https://gitlab.com/gitlab-org/gitlab/-/raw/master/config/upgrade_path.yml"
88
88
  ).body
89
89
  end
90
90
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '14.10.0'
5
+ VERSION = '14.12.0'
6
6
  end
7
7
  end
@@ -119,7 +119,6 @@ module RuboCop
119
119
  'GCS_CDN_BUCKET_NAME' => :gcs_cdn_bucket_name,
120
120
  'GCS_BUCKET_NAME' => :gcs_bucket_name,
121
121
  'SMOKE_ONLY' => :smoke_only,
122
- 'NO_ADMIN' => :no_admin,
123
122
  'CHROME_DISABLE_DEV_SHM' => :chrome_disable_dev_shm,
124
123
  'COLORIZED_LOGS' => :colorized_logs,
125
124
  'FIPS' => :fips,
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: 14.10.0
4
+ version: 14.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-12 00:00:00.000000000 Z
11
+ date: 2024-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -409,7 +409,6 @@ files:
409
409
  - lib/gitlab/qa/component/staging.rb
410
410
  - lib/gitlab/qa/component/staging_ref.rb
411
411
  - lib/gitlab/qa/component/suggested_reviewer.rb
412
- - lib/gitlab/qa/component/telegraf.rb
413
412
  - lib/gitlab/qa/docker/command.rb
414
413
  - lib/gitlab/qa/docker/engine.rb
415
414
  - lib/gitlab/qa/docker/volumes.rb
@@ -442,7 +441,6 @@ files:
442
441
  - lib/gitlab/qa/scenario/test/instance/repository_storage.rb
443
442
  - lib/gitlab/qa/scenario/test/instance/smoke.rb
444
443
  - lib/gitlab/qa/scenario/test/instance/staging.rb
445
- - lib/gitlab/qa/scenario/test/instance/staging_geo.rb
446
444
  - lib/gitlab/qa/scenario/test/instance/staging_ref.rb
447
445
  - lib/gitlab/qa/scenario/test/instance/staging_ref_geo.rb
448
446
  - lib/gitlab/qa/scenario/test/integration/ai_gateway.rb
@@ -480,7 +478,6 @@ files:
480
478
  - lib/gitlab/qa/scenario/test/omnibus/image.rb
481
479
  - lib/gitlab/qa/scenario/test/omnibus/update_from_previous.rb
482
480
  - lib/gitlab/qa/scenario/test/omnibus/upgrade.rb
483
- - lib/gitlab/qa/scenario/test/sanity/version.rb
484
481
  - lib/gitlab/qa/service/cluster_provider/base.rb
485
482
  - lib/gitlab/qa/service/cluster_provider/k3d.rb
486
483
  - lib/gitlab/qa/service/kubernetes_cluster.rb
@@ -1,175 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'tempfile'
4
-
5
- module Gitlab
6
- module QA
7
- module Component
8
- # Component to collect docker metrics
9
- #
10
- class Telegraf < Base
11
- DOCKER_IMAGE = 'telegraf'
12
- DOCKER_IMAGE_TAG = '1.21-alpine'
13
- LOG_DIR = '/etc/telegraf/log'
14
-
15
- def initialize
16
- super
17
-
18
- @name = DOCKER_IMAGE
19
- @host_log_dir = "#{Runtime::Env.host_artifacts_dir}/#{@name}"
20
- @environment = Runtime::Env.variables.slice(
21
- 'QA_INFLUXDB_TOKEN',
22
- 'QA_INFLUXDB_URL',
23
- 'QA_RUN_TYPE',
24
- 'CI_JOB_NAME',
25
- 'CI_PIPELINE_ID'
26
- )
27
- end
28
-
29
- attr_reader :name, :host_log_dir, :telegraf_config
30
-
31
- # Start container
32
- #
33
- # @return [void]
34
- def start
35
- docker.run(image: image, tag: tag) do |command|
36
- set_command_args(command)
37
- set_volumes(command)
38
- set_environment(command)
39
- end
40
- end
41
-
42
- # Run prepare commands
43
- #
44
- # @return [void]
45
- def prepare
46
- @telegraf_config = File.open("#{Dir.mktmpdir(nil, ENV.fetch('CI_BUILDS_DIR', nil))}/telegraf.conf",
47
- 'w') do |file|
48
- file.write(config)
49
- file.path
50
- end
51
- FileUtils.mkdir_p(host_log_dir)
52
-
53
- prepare_docker_image
54
- prepare_docker_container
55
- end
56
-
57
- # Run teardown
58
- #
59
- # @return [void]
60
- def teardown
61
- return unless run_telegraf?
62
-
63
- super
64
- end
65
-
66
- private
67
-
68
- # Set custom run command arguments
69
- #
70
- # @param [Docker::Command] command
71
- # @return [void]
72
- def set_command_args(command)
73
- command << '-d'
74
- command << "--name #{name}"
75
- command << "--user root"
76
- command << "--entrypoint telegraf"
77
- end
78
-
79
- # Set volumes
80
- #
81
- # @param [Docker::Command] command
82
- # @return [void]
83
- def set_volumes(command)
84
- command.volume(host_log_dir, LOG_DIR)
85
- command.volume('/var/run/docker.sock', '/var/run/docker.sock')
86
- command.volume(telegraf_config, '/etc/telegraf/telegraf.conf', :ro)
87
- end
88
-
89
- # Set environment variables
90
- #
91
- # @param [Docker::Command] command
92
- # @return [void]
93
- def set_environment(command)
94
- environment.each { |k, v| command.env(k, v) }
95
- end
96
-
97
- # Run main entrypoint
98
- #
99
- # @return [void]
100
- def instance_no_teardown
101
- if run_telegraf?
102
- super
103
- else
104
- Runtime::Logger.debug("Skipping starting telegraf container!")
105
- yield self if block_given?
106
- end
107
- end
108
-
109
- # Should telegraf be started
110
- #
111
- # Run only on CI and skip if metrics explicitly disabled, run_type not set or influx params missing
112
- #
113
- # @return [Boolean]
114
- def run_telegraf?
115
- Runtime::Env.ci && Runtime::Env.qa_export_test_metrics? && Runtime::Env.qa_run_type && !missing_influx_config?
116
- end
117
-
118
- # Influxdb config params missing
119
- #
120
- # @return [Boolean]
121
- def missing_influx_config?
122
- environment.slice('QA_INFLUXDB_TOKEN', 'QA_INFLUXDB_URL').any? { |_k, v| v.blank? }
123
- end
124
-
125
- # Telegraf configuration
126
- #
127
- # @return [String]
128
- def config
129
- <<~CONFIG
130
- [global_tags]
131
- run_type = "${QA_RUN_TYPE}"
132
- pipeline_id = "${CI_PIPELINE_ID}"
133
- job_name = "${CI_JOB_NAME}"
134
-
135
- [agent]
136
- interval = "1s"
137
- round_interval = true
138
- metric_batch_size = 1000
139
- metric_buffer_limit = 10000
140
- collection_jitter = "0s"
141
- flush_interval = "10s"
142
- flush_jitter = "0s"
143
- precision = ""
144
- debug = true
145
- logtarget = "file"
146
- logfile = "#{LOG_DIR}/telegraf.log"
147
- hostname = ""
148
- omit_hostname = false
149
-
150
- [[outputs.influxdb_v2]]
151
- urls = ["${QA_INFLUXDB_URL}"]
152
- token = "${QA_INFLUXDB_TOKEN}"
153
- organization = "gitlab-qa"
154
- bucket = "test-env-stats"
155
-
156
- [[inputs.docker]]
157
- endpoint = "unix:///var/run/docker.sock"
158
- gather_services = false
159
- container_names = []
160
- source_tag = false
161
- container_name_include = []
162
- container_name_exclude = ["#{name}"]
163
- timeout = "5s"
164
- perdevice = false
165
- perdevice_include = []
166
- total = true
167
- total_include = ["cpu", "blkio", "network"]
168
- docker_label_include = []
169
- docker_label_exclude = []
170
- CONFIG
171
- end
172
- end
173
- end
174
- end
175
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Gitlab
4
- module QA
5
- module Scenario
6
- module Test
7
- module Instance
8
- ##
9
- # Run test suite against staging.gitlab.com
10
- #
11
- class StagingGeo < DeploymentBase
12
- def initialize
13
- @suite = 'QA::EE::Scenario::Test::Geo'
14
- end
15
-
16
- def deployment_component
17
- Component::Staging
18
- end
19
-
20
- def non_rspec_args
21
- [
22
- '--primary-address', deployment_component::ADDRESS,
23
- '--secondary-address', deployment_component::GEO_SECONDARY_ADDRESS,
24
- '--without-setup'
25
- ]
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end