bucky-core 0.10.27 → 0.10.28

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: ee7df04195079058c1436ce50e2f56dc33fd09522511675bf707a19b6a09650a
4
- data.tar.gz: 6e7af3108faf5d630364ca7f57b3b583a9b0ca5646d1401f89407ab93c18715f
3
+ metadata.gz: eeefcf8bcc2d13e45aa42b198c5e66ec3dffe066c0552be1b99fda5a53f7c5e6
4
+ data.tar.gz: a1e1b7540ad0822a1c887fbbad8a3014baa5632819e7f644ea306d69aed4cc54
5
5
  SHA512:
6
- metadata.gz: fe3596f14007729b9925ff626836c56d43f9461a1aefebc7ea4b744a4df154685cc6fb8e8e2a862db8f62a01c44b307fbfe65fcc36cf16a056751a04c4f424fb
7
- data.tar.gz: 886d1ef5db5874d82317712420dd7351ca81e5a6add75f73102dc06632d076e319bcd39aae27e770fb91f963459a7fc9d17ccc9aa784da0f5e9fd5db86d7487d
6
+ metadata.gz: 397124781c05957be50eb7b8dff96b05ce5d3df353184e1ab8bf7d7d79dd6c504eb2437d858fca7023e5d971132c8b70f8e341b60b26044e9b1c88e81dd35ae0
7
+ data.tar.gz: 86c4c002aeff3d0253faf518a1dae027a04d659f0729946cafc37c9ec519c70131723fef1c3162811d5997885a068193ff2977aa779659e1c2423a97f9998d09
data/.circleci/config.yml CHANGED
@@ -38,8 +38,6 @@ jobs:
38
38
  working_directory: ~/bucky-core
39
39
  docker:
40
40
  - image: cimg/ruby:3.2.0
41
- environment:
42
- CC_TEST_REPORTER_ID: fd7bd9d517bdf8953c4d4803ca4ad7539d12d5c760048b8daf80cbc7d54fb262
43
41
  steps:
44
42
  - checkout
45
43
  - type: cache-restore
@@ -49,17 +47,15 @@ jobs:
49
47
  key: unit-test-{{ checksum "Gemfile.lock" }}
50
48
  paths:
51
49
  - vendor/bundle
52
- # Download test-reporter
50
+ # Run rspec
53
51
  - run:
54
- name: Setup Code Climate test-reporter
55
- command: |
56
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
57
- chmod +x ./cc-test-reporter
58
- # Run rspec and show on code climate
59
- - run: |
60
- ./cc-test-reporter before-build
61
- bundle exec rspec
62
- ./cc-test-reporter after-build --coverage-input-type simplecov --exit-code $?
52
+ name: Run RSpec tests
53
+ command: bundle exec rspec --format progress --format RspecJunitFormatter --out test-results/rspec/results.xml
54
+ # Store test results
55
+ - store_test_results:
56
+ path: test-results
57
+ - store_artifacts:
58
+ path: test-results
63
59
  static_code_analysis:
64
60
  docker:
65
61
  - image: cimg/ruby:3.2.0
@@ -83,7 +79,7 @@ jobs:
83
79
  - image: cimg/ruby:3.2.0
84
80
  steps:
85
81
  - add_ssh_keys:
86
- finerprints:
82
+ fingerprints:
87
83
  - "6a:f3:d3:b5:a5:da:ce:e0:9f:22:f8:4a:2f:51:67:2b"
88
84
  - checkout
89
85
  - run:
@@ -1,8 +1,11 @@
1
+ #!/bin/bash
2
+ set -eu
3
+
1
4
  VERSION=$(git describe --tags | grep -o -E "([0-9]+\.){1}[0-9]+(\.[0-9]+)?" | head -n1)
2
5
  git config user.email "bucky-operator@users.noreply.github.com"
3
6
  git config user.name "bucky-operator"
4
7
  # Update version.rb
5
- sed -i '' -e "s/VERSION = '[0-9]\{1,\}.[0-9]\{1,\}.[0-9]\{1,\}'/VERSION = '$VERSION'/" lib/bucky/version.rb
8
+ sed -i -e "s/VERSION = '[0-9]\+\.[0-9]\+\.[0-9]\+'/VERSION = '$VERSION'/" lib/bucky/version.rb
6
9
  git diff
7
10
  git checkout master
8
11
  git add lib/bucky/version.rb
@@ -11,4 +14,4 @@ git commit -m "Version $VERSION"
11
14
  gem build bucky-core.gemspec
12
15
  gem push "bucky-core-$VERSION.gem"
13
16
  # Push to master
14
- git push origin master
17
+ git push origin master
@@ -1,3 +1,6 @@
1
+ #!/bin/bash
2
+ set -eu
3
+
1
4
  mkdir ~/.gem
2
5
  echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
3
- chmod 0600 /home/circleci/.gem/credentials
6
+ chmod 0600 /home/circleci/.gem/credentials
data/Dockerfile.dev CHANGED
@@ -16,7 +16,6 @@ RUN apk update && \
16
16
  mysql-dev \
17
17
  openssh \
18
18
  ruby-dev \
19
- ruby-json \
20
19
  tzdata \
21
20
  yaml \
22
21
  yaml-dev \
@@ -16,7 +16,6 @@ RUN apk update && \
16
16
  mysql-dev \
17
17
  openssh \
18
18
  ruby-dev \
19
- ruby-json \
20
19
  tzdata \
21
20
  yaml \
22
21
  yaml-dev \
@@ -21,7 +21,7 @@ module Bucky
21
21
  def save_job_record_and_get_job_id(start_time, command_and_option, fqdn)
22
22
  return 0 if $debug
23
23
 
24
- job_id = @connector.con[:jobs].insert(start_time: start_time, command_and_option: command_and_option, base_fqdn: fqdn)
24
+ job_id = @connector.con[:jobs].insert(start_time:, command_and_option:, base_fqdn: fqdn)
25
25
  @connector.disconnect
26
26
  job_id
27
27
  end
@@ -95,7 +95,7 @@ module Bucky
95
95
  def get_test_case_id(test_suite_id, case_name)
96
96
  return nil if $debug
97
97
 
98
- test_case = @connector.con[:test_cases].filter(test_suite_id: test_suite_id, case_name: case_name).first
98
+ test_case = @connector.con[:test_cases].filter(test_suite_id:, case_name:).first
99
99
  @connector.disconnect
100
100
  raise "Cannot get test_case id. test_suite_id: #{test_suite_id}, case_name: #{case_name}" if test_case.nil?
101
101
 
@@ -106,11 +106,26 @@ module Bucky
106
106
  # @param [Int] job_id
107
107
  # @return [Int] round
108
108
  def get_last_round_from_job_id(job_id)
109
- round = @connector.con[:test_case_results].where(job_id: job_id).max(:round)
109
+ round = @connector.con[:test_case_results].where(job_id:).max(:round)
110
110
  @connector.disconnect
111
111
  round
112
112
  end
113
113
 
114
+ # Update job record with end_time and duration
115
+ # @param [Integer] job_id
116
+ # @param [Time] end_time
117
+ # @param [Float] duration
118
+ def update_job_record(job_id, end_time, duration)
119
+ rounded_duration = duration.round(2)
120
+ return if $debug
121
+
122
+ @connector.con[:jobs].where(id: job_id).update(
123
+ end_time:,
124
+ duration: rounded_duration
125
+ )
126
+ @connector.disconnect
127
+ end
128
+
114
129
  private
115
130
 
116
131
  # Common method for getting suite
@@ -131,7 +146,7 @@ module Bucky
131
146
  test_suite_name: test_data[:test_suite_name],
132
147
  suite_description: test_data[:suite][:desc],
133
148
  github_url: @config[:test_code_repo],
134
- file_path: file_path
149
+ file_path:
135
150
  )
136
151
  saved_test_suite[:id]
137
152
  else # If there is no test_suite, save new record and return suite_id.
@@ -143,7 +158,7 @@ module Bucky
143
158
  test_suite_name: test_data[:test_suite_name],
144
159
  suite_description: test_data[:suite][:desc],
145
160
  github_url: @config[:test_code_repo],
146
- file_path: file_path
161
+ file_path:
147
162
  )
148
163
  end
149
164
  end
@@ -159,11 +174,11 @@ module Bucky
159
174
  return nil if labels.empty?
160
175
 
161
176
  labels.each do |label_name|
162
- label = @connector.con[:labels].filter(label_name: label_name).first
177
+ label = @connector.con[:labels].filter(label_name:).first
163
178
  label_ids << if label
164
179
  label[:id]
165
180
  else
166
- @connector.con[:labels].insert(label_name: label_name)
181
+ @connector.con[:labels].insert(label_name:)
167
182
  end
168
183
  end
169
184
  label_ids
@@ -180,14 +195,14 @@ module Bucky
180
195
  # Create new connection
181
196
  # If there is no labels, return nil
182
197
  label_ids&.each do |label_id|
183
- @connector.con[:test_case_labels].insert(test_case_id: saved_test_case[:id], label_id: label_id)
198
+ @connector.con[:test_case_labels].insert(test_case_id: saved_test_case[:id], label_id:)
184
199
  end
185
200
  else
186
201
  # Add case data
187
202
  test_case_id = @connector.con[:test_cases].insert(test_suite_id: suite_id, case_name: test_case[:case_name], case_description: test_case[:desc])
188
203
  # If there is no labels, return nil
189
204
  label_ids&.each do |label_id|
190
- @connector.con[:test_case_labels].insert(test_case_id: test_case_id, label_id: label_id)
205
+ @connector.con[:test_case_labels].insert(test_case_id:, label_id:)
191
206
  end
192
207
  end
193
208
  end
@@ -55,7 +55,7 @@ module Bucky
55
55
  data_set_grouped = data_set.group_by.with_index { |_elem, index| index % max_processes }
56
56
  r_pipe, w_pipe = IO.pipe
57
57
  # Use 'values' method to get only hash's key into an array
58
- data_set_grouped.values.each do |data_for_pre_worker|
58
+ data_set_grouped.each_value do |data_for_pre_worker|
59
59
  # Number of child process is equal to max_processes (or equal to data_set length when data_set length is less than max_processes)
60
60
  fork do
61
61
  data_for_pre_worker.each { |data| block.call(data, w_pipe) }
@@ -112,6 +112,11 @@ module Bucky
112
112
 
113
113
  def run
114
114
  execute_test
115
+
116
+ # Update job record with end_time and duration when test completes
117
+ @end_time = Time.now
118
+ @duration = @end_time - @start_time
119
+ @tdo.update_job_record($job_id, @end_time, @duration)
115
120
  end
116
121
 
117
122
  # Rerun by job id
@@ -122,6 +127,11 @@ module Bucky
122
127
  is_error: 1, job_id: rerun_job_id, round: $round
123
128
  )
124
129
  execute_test
130
+
131
+ # Update job record with end_time and duration when test completes
132
+ @end_time = Time.now
133
+ @duration = @end_time - @start_time
134
+ @tdo.update_job_record($job_id, @end_time, @duration)
125
135
  end
126
136
 
127
137
  private
@@ -142,10 +152,10 @@ module Bucky
142
152
  linkstatus_parallel_num = Bucky::Utils::Config.instance[:linkstatus_parallel_num]
143
153
  tcg = Bucky::Core::TestCore::TestClassGenerator.new(@test_cond)
144
154
  case @test_cond[:test_category]
145
- when 'e2e' then results_set = parallel_new_worker_each(test_suite_data, e2e_parallel_num) { |data, w_pipe| tcg.generate_test_class(data: data, w_pipe: w_pipe) }
146
- when 'linkstatus' then
155
+ when 'e2e' then results_set = parallel_new_worker_each(test_suite_data, e2e_parallel_num) { |data, w_pipe| tcg.generate_test_class(data:, w_pipe:) }
156
+ when 'linkstatus'
147
157
  linkstatus_url_log = {}
148
- results_set = parallel_distribute_into_workers(test_suite_data, linkstatus_parallel_num) { |data, w_pipe| tcg.generate_test_class(data: data, linkstatus_url_log: linkstatus_url_log, w_pipe: w_pipe) }
158
+ results_set = parallel_distribute_into_workers(test_suite_data, linkstatus_parallel_num) { |data, w_pipe| tcg.generate_test_class(data:, linkstatus_url_log:, w_pipe:) }
149
159
  end
150
160
 
151
161
  results_set
data/lib/bucky/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bucky
4
4
  module Version
5
- VERSION = '0.10.27'
5
+ VERSION = '0.10.28'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bucky-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.27
4
+ version: 0.10.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - NaotoKishino
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: exe
15
15
  cert_chain: []
16
- date: 2025-02-13 00:00:00.000000000 Z
16
+ date: 2026-01-30 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: awesome_print