bucky-core 0.9.7 → 0.9.8
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 +4 -4
- data/Gemfile.lock +1 -1
- data/example/bucky-management/config/bucky_config.yml +0 -1
- data/example/bucky-management/config/e2e_config.yml +1 -0
- data/example/bucky-management/config/linkstatus_config.yml +2 -1
- data/example/hands-on/config/bucky_config.yml +0 -1
- data/example/hands-on/config/e2e_config.yml +1 -0
- data/example/hands-on/config/linkstatus_config.yml +2 -1
- data/lib/bucky/core/test_core/test_class_generator.rb +1 -1
- data/lib/bucky/core/test_core/test_manager.rb +54 -27
- data/lib/bucky/test_equipment/verifications/status_checker.rb +1 -1
- data/lib/bucky/version.rb +1 -1
- data/system_testing/test_bucky_project/config/bucky_config.yml +0 -1
- data/system_testing/test_bucky_project/config/e2e_config.yml +1 -0
- data/system_testing/test_bucky_project/config/linkstatus_config.yml +2 -1
- data/template/new/config/bucky_config.yml +0 -1
- data/template/new/config/e2e_config.yml +1 -0
- data/template/new/config/linkstatus_config.yml +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b95714bd12694e6553a7508e5ce8424c65016a3c
|
4
|
+
data.tar.gz: 122c0438f73abb49378de85057b76bb484cb5dfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 466c39aa4ab15ad570b47f2f3dd453b9e5119517c0ea15d6e84b9a7e948a7aa697659812224cf55b7527e6e85b41381720842f2b8718b0c052bfc75712b202e4
|
7
|
+
data.tar.gz: 4535e3f1e50b7ad9b74612872b3bba0a6d8cbea650fbaa018b8f4baebcaac8757a5c31ef0827121e48c0e47d82bfccf2b47e0b510978aacb3ae1bde3224abbc9
|
data/Gemfile.lock
CHANGED
@@ -45,7 +45,7 @@ module Bucky
|
|
45
45
|
end
|
46
46
|
|
47
47
|
# Genrate test class by test suite and test case data
|
48
|
-
def generate_test_class(data, link_status_url_log)
|
48
|
+
def generate_test_class(data, link_status_url_log = {})
|
49
49
|
test_cond = @test_cond
|
50
50
|
# Common proccessing
|
51
51
|
# e.g.) TestSampleAppPcE2e1, TestSampleAppPcHttpstatus1
|
@@ -8,7 +8,50 @@ require_relative './test_class_generator'
|
|
8
8
|
module Bucky
|
9
9
|
module Core
|
10
10
|
module TestCore
|
11
|
+
module ParallelHelper
|
12
|
+
parent_pid = Process.pid
|
13
|
+
|
14
|
+
# Terminate parent and child process when getting interrupt signal
|
15
|
+
Signal.trap('INT') do
|
16
|
+
Process.kill('TERM', -1 * parent_pid)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def parallel_new_worker_each(data_set, max_processes, &block)
|
22
|
+
# Max parallel workers number
|
23
|
+
available_workers = max_processes
|
24
|
+
|
25
|
+
# If child process dead, available workers increase
|
26
|
+
Signal.trap('CLD') { available_workers += 1 }
|
27
|
+
|
28
|
+
data_set.each do |data|
|
29
|
+
# Wait until worker is available
|
30
|
+
Process.wait unless available_workers.positive?
|
31
|
+
# Workers decrease when start working
|
32
|
+
available_workers -= 1
|
33
|
+
fork { block.call(data) }
|
34
|
+
end
|
35
|
+
Process.waitall
|
36
|
+
end
|
37
|
+
|
38
|
+
def parallel_distribute_into_workers(data_set, max_processes, &block)
|
39
|
+
# Group the data by remainder of index
|
40
|
+
data_set_grouped = data_set.group_by.with_index { |_elem, index| index % max_processes }
|
41
|
+
# Use 'values' method to get only hash's key into an array
|
42
|
+
data_set_grouped.values.each do |data_for_pre_worker|
|
43
|
+
# Number of child process is equal to max_processes (or equal to data_set length when data_set length is less than max_processes)
|
44
|
+
fork do
|
45
|
+
data_for_pre_worker.each { |data| block.call(data) }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
Process.waitall
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
11
52
|
class TestManager
|
53
|
+
include ParallelHelper
|
54
|
+
|
12
55
|
# Keep test conditions and round number
|
13
56
|
def initialize(test_cond)
|
14
57
|
@test_cond = test_cond
|
@@ -45,8 +88,17 @@ module Bucky
|
|
45
88
|
|
46
89
|
# Generate and execute test
|
47
90
|
def do_test_suites(test_suite_data)
|
48
|
-
|
49
|
-
|
91
|
+
# For checking on linkstatus
|
92
|
+
e2e_parallel_num = Bucky::Utils::Config.instance[:e2e_parallel_num]
|
93
|
+
linkstatus_parallel_num = Bucky::Utils::Config.instance[:linkstatus_parallel_num]
|
94
|
+
tcg = Bucky::Core::TestCore::TestClassGenerator.new(@test_cond)
|
95
|
+
|
96
|
+
case @test_cond[:test_category][0]
|
97
|
+
when 'e2e' then parallel_new_worker_each(test_suite_data, e2e_parallel_num) { |data| tcg.generate_test_class(data) }
|
98
|
+
when 'linkstatus' then
|
99
|
+
link_status_url_log = {}
|
100
|
+
parallel_distribute_into_workers(test_suite_data, linkstatus_parallel_num) { |data| tcg.generate_test_class(data, link_status_url_log) }
|
101
|
+
end
|
50
102
|
end
|
51
103
|
|
52
104
|
def execute_test
|
@@ -60,31 +112,6 @@ module Bucky
|
|
60
112
|
break if @test_cond[:re_test_cond].empty?
|
61
113
|
end
|
62
114
|
end
|
63
|
-
|
64
|
-
def parallel_helper(test_suite_data, max_processes)
|
65
|
-
# Max parallel workers number
|
66
|
-
available_workers = max_processes
|
67
|
-
# For checking on linkstatus
|
68
|
-
link_status_url_log = {}
|
69
|
-
parent_pid = Process.pid
|
70
|
-
tcg = Bucky::Core::TestCore::TestClassGenerator.new(@test_cond)
|
71
|
-
|
72
|
-
# If child process dead, available workers increase
|
73
|
-
Signal.trap('CLD') { available_workers += 1 }
|
74
|
-
# Terminate parent and child process when getting interrupt signal
|
75
|
-
Signal.trap('INT') do
|
76
|
-
Process.kill('TERM', -1 * parent_pid)
|
77
|
-
end
|
78
|
-
|
79
|
-
test_suite_data.each do |data|
|
80
|
-
# Wait until worker is available
|
81
|
-
Process.wait unless available_workers.positive?
|
82
|
-
# Workers decrease when start working
|
83
|
-
available_workers -= 1
|
84
|
-
fork { tcg.generate_test_class(data, link_status_url_log) }
|
85
|
-
end
|
86
|
-
Process.waitall
|
87
|
-
end
|
88
115
|
end
|
89
116
|
end
|
90
117
|
end
|
@@ -90,7 +90,7 @@ module Bucky
|
|
90
90
|
links = exclude(links, exclude_urls) unless exclude_urls.nil?
|
91
91
|
|
92
92
|
errors = []
|
93
|
-
Parallel.each(links.uniq, in_threads: Bucky::Utils::Config.instance[:
|
93
|
+
Parallel.each(links.uniq, in_threads: Bucky::Utils::Config.instance[:linkstatus_thread_num]) do |link|
|
94
94
|
http_status_check_args[:url] = link
|
95
95
|
http_status_check_args[:redirect_url_list] = []
|
96
96
|
link_response = http_status_check(http_status_check_args)
|
data/lib/bucky/version.rb
CHANGED
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.9.
|
4
|
+
version: 0.9.8
|
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: 2019-06-
|
16
|
+
date: 2019-06-25 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: awesome_print
|