File: 004_disable-unreliable-timing-tests.patch

package info (click to toggle)
ruby-sshkit 1.25.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 712 kB
  • sloc: ruby: 3,749; makefile: 2
file content (107 lines) | stat: -rw-r--r-- 3,985 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Description: Disable unreliable timing tests
Author: Sebastien Badia <sbadia@debian.org>
Bug-Debian: https://bugs.debian.org/853244
Forwarded: not-needed
Last-Update: 2020-02-04

Index: ruby-sshkit/test/unit/test_coordinator.rb
===================================================================
--- ruby-sshkit.orig/test/unit/test_coordinator.rb
+++ ruby-sshkit/test/unit/test_coordinator.rb
@@ -43,12 +43,6 @@ module SSHKit
       assert_equal "Command: echo 1.example.com\n", actual_output_commands.last
     end
 
-    def test_the_connection_manaager_runs_things_in_parallel_by_default
-      Coordinator.new(%w{1.example.com 2.example.com}).each(&echo_time)
-      assert_equal 2, actual_execution_times.length
-      assert_within_10_ms(actual_execution_times)
-    end
-
     def test_the_connection_manager_can_run_things_in_sequence
       Coordinator.new(%w{1.example.com 2.example.com}).each in: :sequence, &echo_time
       assert_equal 2, actual_execution_times.length
@@ -68,46 +62,6 @@ module SSHKit
       end
     end
 
-    def test_the_connection_manager_can_run_things_in_custom_runner
-      begin
-        $original_runner = SSHKit.config.default_runner
-        SSHKit.config.default_runner = MyRunner
-
-        Coordinator.new(%w{1.example.com 2.example.com}).each(&echo_time)
-        assert_equal 2, actual_execution_times.length
-        assert_within_10_ms(actual_execution_times)
-        assert_match(/custom runner out/, @output)
-      ensure
-        SSHKit.config.default_runner = $original_runner
-      end
-    end
-
-    def test_the_connection_manager_can_run_things_with_custom_runner_configs
-      begin
-        $original_runner = SSHKit.config.default_runner
-        SSHKit.config.default_runner = :groups
-        $original_runner_config = SSHKit.config.default_runner_config
-        SSHKit.config.default_runner_config = { limit: 2, wait: 5 }
-
-        Coordinator.new(
-          %w{
-            1.example.com
-            2.example.com
-            3.example.com
-            4.example.com
-          }
-        ).each(&echo_time)
-        assert_equal 4, actual_execution_times.length
-        assert_within_10_ms(actual_execution_times[0..1])
-        assert_within_10_ms(actual_execution_times[2..3])
-        assert_at_least_5_sec_apart(actual_execution_times[0], actual_execution_times[2])
-        assert_at_least_5_sec_apart(actual_execution_times[1], actual_execution_times[3])
-      ensure
-        SSHKit.config.default_runner = $original_runner
-        SSHKit.config.default_runner_config = $original_runner_config
-      end
-    end
-
     def test_the_connection_manager_can_run_things_in_sequence_with_wait
       start = Time.now
       Coordinator.new(%w{1.example.com 2.example.com}).each in: :sequence, wait: 10, &echo_time
@@ -115,25 +69,6 @@ module SSHKit
       assert_operator(stop - start, :>=, 10.0)
     end
 
-    def test_the_connection_manager_can_run_things_in_groups
-      Coordinator.new(
-        %w{
-          1.example.com
-          2.example.com
-          3.example.com
-          4.example.com
-          5.example.com
-          6.example.com
-        }
-      ).each in: :groups, &echo_time
-      assert_equal 6, actual_execution_times.length
-      assert_within_10_ms(actual_execution_times[0..1])
-      assert_within_10_ms(actual_execution_times[2..3])
-      assert_within_10_ms(actual_execution_times[4..5])
-      assert_at_least_1_sec_apart(actual_execution_times[1], actual_execution_times[2])
-      assert_at_least_1_sec_apart(actual_execution_times[3], actual_execution_times[4])
-    end
-
     private
 
     def assert_at_least_1_sec_apart(first_time, last_time)
@@ -144,10 +79,6 @@ module SSHKit
       assert_operator(last_time - first_time, :>, 5.0)
     end
 
-    def assert_within_10_ms(array)
-      assert_in_delta(*array, 0.01) # 10 msec
-    end
-
     def actual_execution_times
       actual_output_commands.map { |line| line.split(' ').last.to_f }
     end