gitlab-qa 7.24.6 → 7.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+ # rubocop:disable Metrics/AbcSize
3
+
4
+ class LicenseUsageSeed
5
+ def self.seed!
6
+ admin_user = User.find_by(username: 'root')
7
+ group_count = seed_groups.count
8
+ user_count = seed_users.count
9
+
10
+ puts 'Start seeding license usage data...'
11
+
12
+ rand(5..20).times { create_group(admin_user) }
13
+ create_users_and_members
14
+
15
+ puts 'Creating License usage record...'
16
+ create_license_usage_record
17
+
18
+ puts "Created #{seed_users.count - user_count} users and #{seed_groups.count - group_count} groups."
19
+ puts 'License usage data seeding completed.'
20
+ end
21
+
22
+ def self.create_user
23
+ name = "test-user#{SecureRandom.hex(8)}"
24
+
25
+ User.create!(
26
+ email: "#{name}@test.com",
27
+ password: 'password',
28
+ username: name,
29
+ name: "User #{name}",
30
+ confirmed_at: Time.current
31
+ )
32
+ end
33
+
34
+ def self.create_group(user)
35
+ name = "test-group#{SecureRandom.hex(8)}"
36
+ group_params =
37
+ {
38
+ name: name,
39
+ path: name
40
+ }
41
+ ::Groups::CreateService.new(user, group_params).execute
42
+ end
43
+
44
+ def self.create_users_and_members
45
+ seed_groups.pluck(:id).each do |group_id|
46
+ 3.times { create_member(create_user, group_id) }
47
+ end
48
+ end
49
+
50
+ def self.create_member(user, group_id)
51
+ roles = Gitlab::Access.values
52
+
53
+ GroupMember.create(user_id: user.id, access_level: roles.sample, source_id: group_id)
54
+ end
55
+
56
+ def self.seed_users
57
+ User.where('username ~* ?', '^test-user')
58
+ end
59
+
60
+ def self.seed_groups
61
+ Group.where('name ~* ?', '^test-group')
62
+ end
63
+
64
+ def self.create_license_usage_record
65
+ # Force update daily billable users and historical license data
66
+ identifier = Analytics::UsageTrends::Measurement.identifiers[:billable_users]
67
+ ::Analytics::UsageTrends::CounterJobWorker.new.perform(identifier, User.minimum(:id), User.maximum(:id), Time.zone.now)
68
+
69
+ HistoricalData.track!
70
+ end
71
+ end
72
+
73
+ LicenseUsageSeed.seed!
74
+
75
+ # rubocop:enable Metrics/AbcSize
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.24.6
4
+ version: 7.25.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: 2022-03-30 00:00:00.000000000 Z
11
+ date: 2022-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -325,6 +325,7 @@ files:
325
325
  - lib/gitlab/qa/scenario/test/instance/staging.rb
326
326
  - lib/gitlab/qa/scenario/test/instance/staging_geo.rb
327
327
  - lib/gitlab/qa/scenario/test/instance/staging_ref.rb
328
+ - lib/gitlab/qa/scenario/test/instance/staging_ref_geo.rb
328
329
  - lib/gitlab/qa/scenario/test/integration/actioncable.rb
329
330
  - lib/gitlab/qa/scenario/test/integration/client_ssl.rb
330
331
  - lib/gitlab/qa/scenario/test/integration/elasticsearch.rb
@@ -344,6 +345,7 @@ files:
344
345
  - lib/gitlab/qa/scenario/test/integration/praefect.rb
345
346
  - lib/gitlab/qa/scenario/test/integration/registry.rb
346
347
  - lib/gitlab/qa/scenario/test/integration/registry_tls.rb
348
+ - lib/gitlab/qa/scenario/test/integration/registry_with_cdn.rb
347
349
  - lib/gitlab/qa/scenario/test/integration/saml.rb
348
350
  - lib/gitlab/qa/scenario/test/integration/service_ping_disabled.rb
349
351
  - lib/gitlab/qa/scenario/test/integration/smtp.rb
@@ -359,6 +361,8 @@ files:
359
361
  - lib/gitlab/qa/support/invalid_response_error.rb
360
362
  - lib/gitlab/qa/test_logger.rb
361
363
  - lib/gitlab/qa/version.rb
364
+ - scripts/generate-qa-jobs.rb
365
+ - support/data/license_usage_seed.rb
362
366
  - tls_certificates/authority/ca.crt
363
367
  - tls_certificates/authority/ca.key
364
368
  - tls_certificates/authority/ca.pem