repla 0.8.2 → 0.8.3
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/lib/repla/logger/test/lib/log_helper.rb +1 -1
- data/lib/repla/logger/test/lib/log_tester.rb +73 -28
- data/lib/repla/logger/test/tc_logger.rb +7 -2
- data/lib/repla/test/packages/TestLog.replaplugin/Contents/Info.plist +1 -1
- data/lib/repla/test/packages/TestLog.replaplugin/Contents/Resources/echo.sh +1 -1
- data/lib/repla/test/packages/TestLog.replaplugin/Contents/Resources/run.sh +6 -0
- data/lib/repla/test.rb +3 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57bbe0e7d55bf6e9d44f2c7f069040ac838954bf
|
4
|
+
data.tar.gz: '008ce57baa887b6b42d3087010f4c2e067ec5682'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 917eedbbd7e7595b795a82e87aa21a14777949fbeb5b83af7673830e61719e2bf898af1417473717434629124b7d4b334eee1faa76d04c7e93bf2dc16fe8d5b9
|
7
|
+
data.tar.gz: e81ca1c9530aeec1c0764a647eeeab2135bd14e7498f7659af1aa75bb363a479cb653d425d379eb74eb4651216b1b12ae3cb7bb3bdf33be28f3bb709942ec519
|
@@ -1,48 +1,93 @@
|
|
1
1
|
module Repla
|
2
2
|
# Test
|
3
3
|
module Test
|
4
|
-
|
4
|
+
ERROR_MESSAGES = [
|
5
5
|
'Testing log error',
|
6
|
+
'ERROR'
|
7
|
+
].freeze
|
8
|
+
MESSAGES = [
|
6
9
|
'Testing log message',
|
7
|
-
'ERROR',
|
8
10
|
'MESSAGE',
|
9
11
|
'Done'
|
10
12
|
].freeze
|
11
|
-
|
12
|
-
error
|
13
|
-
message
|
14
|
-
message
|
15
|
-
message
|
16
|
-
message
|
17
|
-
].freeze
|
13
|
+
MESSAGE_COUNT = ERROR_MESSAGES.count + MESSAGES.count
|
18
14
|
def self.test_log(window)
|
19
|
-
test_message = 'Done'
|
20
15
|
test_log_helper = Repla::Test::LogHelper.new(window.window_id)
|
21
|
-
|
16
|
+
result = nil
|
17
|
+
expected = MESSAGE_COUNT
|
22
18
|
Repla::Test.block_until do
|
23
|
-
|
24
|
-
|
19
|
+
result = test_log_helper.number_of_log_messages
|
20
|
+
result == expected
|
25
21
|
end
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
type
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
return false
|
22
|
+
error_messages = []
|
23
|
+
messages = []
|
24
|
+
(0...MESSAGE_COUNT).each do |i|
|
25
|
+
message = test_log_helper.log_message_at(i)
|
26
|
+
type = test_log_helper.log_class_at(i)
|
27
|
+
next if message.nil?
|
28
|
+
|
29
|
+
if type == 'error'
|
30
|
+
error_messages.push(message)
|
31
|
+
else
|
32
|
+
messages.push(message)
|
38
33
|
end
|
39
34
|
end
|
40
|
-
expected = MESSAGES.count
|
41
|
-
result = test_log_helper.number_of_log_messages
|
42
35
|
if expected != result
|
43
|
-
STDERR.puts "Expected #{expected} instead of #{result}"
|
36
|
+
STDERR.puts "Expected #{expected} total messages instead of #{result}"
|
37
|
+
STDERR.puts "Messages #{messages}"
|
38
|
+
STDERR.puts "Error messages #{error_messages}"
|
39
|
+
return false
|
40
|
+
end
|
41
|
+
# Buffering issues are causing the output of `TestLog.replaplugin` to be
|
42
|
+
# unreliable, so for now we're running it through `/usr/bin/script`.
|
43
|
+
# Which is reliable, but standard out and standard error get combined.
|
44
|
+
combined_expected = ERROR_MESSAGES + MESSAGES
|
45
|
+
combined_result = error_messages + messages
|
46
|
+
expected = combined_expected.count
|
47
|
+
result = combined_result.count
|
48
|
+
if expected != result
|
49
|
+
STDERR.puts "Expected #{expected} messages instead of #{result}"
|
50
|
+
return false
|
51
|
+
end
|
52
|
+
(0..combined_expected.count).each do |i|
|
53
|
+
expected = combined_expected[i]
|
54
|
+
result = messages[i]
|
55
|
+
next unless expected != result
|
56
|
+
|
57
|
+
STDERR.puts "At index #{i}, expected message #{expected} instead of "\
|
58
|
+
"#{result}"
|
44
59
|
return false
|
45
60
|
end
|
61
|
+
# expected = MESSAGES.count
|
62
|
+
# result = messages.count
|
63
|
+
# if expected != result
|
64
|
+
# STDERR.puts "Expected #{expected} messages instead of #{result}"
|
65
|
+
# return false
|
66
|
+
# end
|
67
|
+
# expected = ERROR_MESSAGES.count
|
68
|
+
# result = error_messages.count
|
69
|
+
# if ERROR_MESSAGES.count != error_messages.count
|
70
|
+
# STDERR.puts "Expected #{expected} error messages instead of #{result}"
|
71
|
+
# return false
|
72
|
+
# end
|
73
|
+
# (0..MESSAGES.count).each do |i|
|
74
|
+
# expected = MESSAGES[i]
|
75
|
+
# result = messages[i]
|
76
|
+
# if expected != result
|
77
|
+
# STDERR.puts "At index #{i}, expected message #{expected} instead "\
|
78
|
+
# "of #{result}"
|
79
|
+
# return false
|
80
|
+
# end
|
81
|
+
# end
|
82
|
+
# (0..ERROR_MESSAGES.count).each do |i|
|
83
|
+
# expected = ERROR_MESSAGES[i]
|
84
|
+
# result = error_messages[i]
|
85
|
+
# if expected != result
|
86
|
+
# STDERR.puts "At index #{i}, expected error message #{expected} "\
|
87
|
+
# "instead of #{result}"
|
88
|
+
# return false
|
89
|
+
# end
|
90
|
+
# end
|
46
91
|
true
|
47
92
|
end
|
48
93
|
end
|
@@ -65,12 +65,17 @@ class TestLoggerObject < Minitest::Test
|
|
65
65
|
|
66
66
|
def test_logger_object
|
67
67
|
# Test Error
|
68
|
+
# This test doesn't call `@logger.error` because `TestLog.replaplugin` had
|
69
|
+
# to be changed being run with `/usr/bin/script` which combines standard
|
70
|
+
# output and standard error.
|
68
71
|
message = 'Testing log error'
|
69
|
-
@logger.error(message)
|
70
|
-
message = 'Testing log message'
|
71
72
|
@logger.info(message)
|
73
|
+
# @logger.error(message)
|
72
74
|
message = Repla::Logger::ERROR_PREFIX.rstrip
|
73
75
|
@logger.info(message)
|
76
|
+
# @logger.error(message)
|
77
|
+
message = 'Testing log message'
|
78
|
+
@logger.info(message)
|
74
79
|
message = Repla::Logger::MESSAGE_PREFIX.rstrip
|
75
80
|
@logger.info(message)
|
76
81
|
@logger.info('')
|
data/lib/repla/test.rb
CHANGED
@@ -24,8 +24,9 @@ module Repla
|
|
24
24
|
'http://127.0.0.1:5000/' + filename
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.block_until_with_timeout(timeout
|
28
|
-
|
27
|
+
def self.block_until_with_timeout(timeout,
|
28
|
+
polling_interval = POLLING_INTERVAL)
|
29
|
+
cycles = [timeout / polling_interval, 1].max
|
29
30
|
count = 0
|
30
31
|
until yield || count >= cycles
|
31
32
|
sleep(POLLING_INTERVAL)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roben Kleene
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- lib/repla/test/packages/TestEnvironment.replaplugin/Contents/Resources/test_environment.rb
|
142
142
|
- lib/repla/test/packages/TestLog.replaplugin/Contents/Info.plist
|
143
143
|
- lib/repla/test/packages/TestLog.replaplugin/Contents/Resources/echo.sh
|
144
|
+
- lib/repla/test/packages/TestLog.replaplugin/Contents/Resources/run.sh
|
144
145
|
- lib/repla/test/packages/TestServer.replaplugin/Contents/Info.plist
|
145
146
|
- lib/repla/test/packages/TestServer.replaplugin/Contents/Resources/server.sh
|
146
147
|
homepage:
|