gitlab_quality-test_tooling 0.8.0 → 0.8.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed3ddf73e69dbf985ff11b7192c25055281b4559b53f3961ff7c4de033872e70
4
- data.tar.gz: 30de36dd668dd20ab52a19c12cbf3b68f87041cd12bf495692686f2e813a3332
3
+ metadata.gz: d201b5e75d11490d7b8a3f7b3abdc883442487d07d19f9c5c7cf02577a867116
4
+ data.tar.gz: 0b50d503726912d587bb2b3d4bd1e1c2194b8f0773d2a37905afa0c66dfbbaee
5
5
  SHA512:
6
- metadata.gz: 1dcb1a3f77b47b5ecafd5a425b2de398cedc6caf3b7fa4e4f0a351d467f723329e7382a592936064ff4969b25976e9b3b88553610d33b88db2e22a42c0e2917d
7
- data.tar.gz: 0bb812067345d488cfea73ad4d25e396aeea79eaa2a0790de5607e20e3ce08a1e2a96990f8ee1523d52d1c95112e7b99755dfa8857731337a05466d90bbb0925
6
+ metadata.gz: e5b8c615d62f29710c55a3d39373efb71cf1b7895d3b7ca08d6a4e0077e47b7a0c109f111716d49d7d5adcac4b3ffc8668c20fcb95fc01bfb2244c38bfafba62
7
+ data.tar.gz: 30b05b1eac9f9b6400e089b1de4e229fcd5769aae2a41066bc43e79e08f6a6c37db8e4b7cbbfd46933021eabafa098be601a546c5cc05d7a93fa4c01d5c14021
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (0.8.0)
5
- activesupport (~> 6.1)
4
+ gitlab_quality-test_tooling (0.8.2)
5
+ activesupport (>= 6.1, < 7.1)
6
6
  gitlab (~> 4.19)
7
7
  http (~> 5.0)
8
8
  nokogiri (~> 1.10)
@@ -12,18 +12,12 @@ module GitlabQuality
12
12
  @input_files = input_files
13
13
  end
14
14
 
15
- REGEX = %r{(?<gitlab_qa_run>gitlab-qa-run-.*?(?=/))/(?<gitlab_ce_ee_qa>gitlab-(?:ee|ce)-qa-.*?(?=/))}
16
15
  CONTAINER_PATH = File.join('/home', 'gitlab', 'qa', 'tmp').freeze
17
16
 
18
17
  def invoke!
19
18
  Dir.glob(input_files).each do |input_file|
20
- match_data = input_file.match(REGEX)
21
- next unless match_data
22
-
23
- host_relative_path = "#{match_data[:gitlab_qa_run]}/#{match_data[:gitlab_ce_ee_qa]}"
24
-
25
- rewrite_schreenshot_paths_in_junit_file(input_file, host_relative_path)
26
- rewrite_schreenshot_paths_in_json_file(input_file.gsub('.xml', '.json'), host_relative_path)
19
+ rewrite_schreenshot_paths_in_junit_file(input_file)
20
+ rewrite_schreenshot_paths_in_json_file(input_file.gsub('.xml', '.json'))
27
21
  end
28
22
  end
29
23
 
@@ -31,35 +25,35 @@ module GitlabQuality
31
25
 
32
26
  attr_reader :input_files
33
27
 
34
- def rewrite_schreenshot_paths_in_junit_file(junit_file, host_relative_path)
28
+ def rewrite_schreenshot_paths_in_junit_file(junit_file)
35
29
  File.write(
36
30
  junit_file,
37
- rewrite_each_junit_screenshot_path(junit_file, host_relative_path).to_s
31
+ rewrite_each_junit_screenshot_path(junit_file).to_s
38
32
  )
39
33
 
40
34
  puts "Saved #{junit_file}"
41
35
  end
42
36
 
43
- def rewrite_schreenshot_paths_in_json_file(json_file, host_relative_path)
37
+ def rewrite_schreenshot_paths_in_json_file(json_file)
44
38
  File.write(
45
39
  json_file,
46
40
  JSON.pretty_generate(
47
- rewrite_each_json_screenshot_path(json_file, host_relative_path)
41
+ rewrite_each_json_screenshot_path(json_file)
48
42
  )
49
43
  )
50
44
 
51
45
  puts "Saved #{json_file}"
52
46
  end
53
47
 
54
- def rewrite_each_junit_screenshot_path(junit_file, host_relative_path)
48
+ def rewrite_each_junit_screenshot_path(junit_file)
55
49
  Nokogiri::XML(File.open(junit_file)).tap do |report|
56
50
  report.xpath('//system-out').each do |system_out|
57
- system_out.content = remove_container_absolute_path_prefix(system_out.content, host_relative_path)
51
+ system_out.content = remove_container_absolute_path_prefix(system_out.content, test_artifacts_directory(junit_file))
58
52
  end
59
53
  end
60
54
  end
61
55
 
62
- def rewrite_each_json_screenshot_path(json_file, host_relative_path)
56
+ def rewrite_each_json_screenshot_path(json_file)
63
57
  JSON.parse(File.read(json_file)).tap do |report|
64
58
  examples = report['examples']
65
59
 
@@ -67,13 +61,17 @@ module GitlabQuality
67
61
  next unless example['screenshot'].present?
68
62
 
69
63
  example['screenshot']['image'] =
70
- remove_container_absolute_path_prefix(example.dig('screenshot', 'image'), host_relative_path)
64
+ remove_container_absolute_path_prefix(example.dig('screenshot', 'image'), test_artifacts_directory(json_file))
71
65
  end
72
66
  end
73
67
  end
74
68
 
75
- def remove_container_absolute_path_prefix(image_container_absolute_path, host_relative_path)
76
- image_container_absolute_path.gsub(CONTAINER_PATH, host_relative_path)
69
+ def remove_container_absolute_path_prefix(image_container_absolute_path, test_artifacts_dir)
70
+ image_container_absolute_path.gsub(CONTAINER_PATH, test_artifacts_dir)
71
+ end
72
+
73
+ def test_artifacts_directory(filepath)
74
+ File.dirname(filepath)
77
75
  end
78
76
  end
79
77
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "0.8.0"
5
+ VERSION = "0.8.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_quality-test_tooling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-09 00:00:00.000000000 Z
11
+ date: 2023-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -182,16 +182,22 @@ dependencies:
182
182
  name: activesupport
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - "~>"
185
+ - - ">="
186
186
  - !ruby/object:Gem::Version
187
187
  version: '6.1'
188
+ - - "<"
189
+ - !ruby/object:Gem::Version
190
+ version: '7.1'
188
191
  type: :runtime
189
192
  prerelease: false
190
193
  version_requirements: !ruby/object:Gem::Requirement
191
194
  requirements:
192
- - - "~>"
195
+ - - ">="
193
196
  - !ruby/object:Gem::Version
194
197
  version: '6.1'
198
+ - - "<"
199
+ - !ruby/object:Gem::Version
200
+ version: '7.1'
195
201
  - !ruby/object:Gem::Dependency
196
202
  name: gitlab
197
203
  requirement: !ruby/object:Gem::Requirement