SimControl 0.1.5 → 0.1.6
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.
- data/Gemfile.lock +1 -1
- data/lib/SimControl/hosts.rb +1 -1
- data/lib/SimControl/version.rb +1 -1
- data/spec/hosts_spec.rb +15 -0
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/lib/SimControl/hosts.rb
CHANGED
@@ -16,7 +16,7 @@ class SimControl::Hosts
|
|
16
16
|
|
17
17
|
def partition(all_scenarios, hostname)
|
18
18
|
return [] if number_of_cores == 0
|
19
|
-
scenario_groups = all_scenarios.
|
19
|
+
scenario_groups = all_scenarios.in_groups(number_of_cores, false)
|
20
20
|
scenario_groups[host_indices hostname]
|
21
21
|
end
|
22
22
|
|
data/lib/SimControl/version.rb
CHANGED
data/spec/hosts_spec.rb
CHANGED
@@ -40,6 +40,21 @@ describe SimControl::Hosts do
|
|
40
40
|
expect(host_b_scenarios.first).to include(scenario_d)
|
41
41
|
end
|
42
42
|
|
43
|
+
it "gives all scenarios to one host if only one host with one core exists" do
|
44
|
+
hosts = SimControl::Hosts.new
|
45
|
+
hosts.use "host-a"
|
46
|
+
scenario_a = {foo: 1}
|
47
|
+
scenario_b = {foo: 2}
|
48
|
+
scenario_c = {foo: 3}
|
49
|
+
scenario_d = {foo: 4}
|
50
|
+
all_scenarios = [scenario_a, scenario_b, scenario_c, scenario_d]
|
51
|
+
host_a_scenarios = hosts.partition all_scenarios, "host-a"
|
52
|
+
expect(host_a_scenarios.first).to include(scenario_a)
|
53
|
+
expect(host_a_scenarios.first).to include(scenario_b)
|
54
|
+
expect(host_a_scenarios.first).to include(scenario_c)
|
55
|
+
expect(host_a_scenarios.first).to include(scenario_d)
|
56
|
+
end
|
57
|
+
|
43
58
|
it "returns the empty list if no hosts exist" do
|
44
59
|
hosts = SimControl::Hosts.new
|
45
60
|
scenario_a = {foo: 1}
|