lazylead 0.3.1 → 0.5.0

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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.0pdd.yml +4 -1
  3. data/.docs/accuracy.md +107 -0
  4. data/.docs/accuracy_email.jpg +0 -0
  5. data/.docs/accuracy_jira_comment.jpg +0 -0
  6. data/.docs/duedate_expired.md +3 -3
  7. data/.docs/propagate_down.md +4 -4
  8. data/.gitattributes +1 -0
  9. data/.github/dependabot.yml +6 -0
  10. data/.pdd +1 -1
  11. data/.rubocop.yml +6 -0
  12. data/Rakefile +2 -0
  13. data/bin/lazylead +7 -4
  14. data/lazylead.gemspec +5 -4
  15. data/lib/lazylead/exchange.rb +16 -9
  16. data/lib/lazylead/log.rb +30 -8
  17. data/lib/lazylead/model.rb +78 -22
  18. data/lib/lazylead/opts.rb +80 -0
  19. data/lib/lazylead/postman.rb +1 -1
  20. data/lib/lazylead/schedule.rb +18 -17
  21. data/lib/lazylead/smtp.rb +1 -1
  22. data/lib/lazylead/system/jira.rb +55 -14
  23. data/lib/lazylead/system/synced.rb +2 -1
  24. data/lib/lazylead/task/accuracy/accuracy.rb +136 -0
  25. data/lib/lazylead/task/accuracy/affected_build.rb +39 -0
  26. data/lib/lazylead/task/accuracy/attachment.rb +44 -0
  27. data/lib/lazylead/task/accuracy/environment.rb +39 -0
  28. data/lib/lazylead/task/accuracy/logs.rb +40 -0
  29. data/lib/lazylead/task/accuracy/records.rb +45 -0
  30. data/lib/lazylead/task/accuracy/requirement.rb +49 -0
  31. data/lib/lazylead/task/accuracy/servers.rb +50 -0
  32. data/lib/lazylead/task/accuracy/stacktrace.rb +63 -0
  33. data/lib/lazylead/task/accuracy/testcase.rb +75 -0
  34. data/lib/lazylead/task/accuracy/wiki.rb +41 -0
  35. data/lib/lazylead/task/alert.rb +8 -6
  36. data/lib/lazylead/task/confluence_ref.rb +4 -3
  37. data/lib/lazylead/task/echo.rb +22 -0
  38. data/lib/lazylead/task/fix_version.rb +18 -7
  39. data/lib/lazylead/task/missing_comment.rb +7 -5
  40. data/lib/lazylead/task/propagate_down.rb +11 -3
  41. data/lib/lazylead/task/savepoint.rb +1 -1
  42. data/lib/lazylead/task/touch.rb +119 -0
  43. data/lib/lazylead/version.rb +1 -1
  44. data/lib/messages/accuracy.erb +118 -0
  45. data/lib/messages/svn_log.erb +117 -0
  46. data/lib/messages/svn_touch.erb +147 -0
  47. data/license.txt +1 -1
  48. data/readme.md +20 -19
  49. data/test/lazylead/cc_test.rb +2 -2
  50. data/test/lazylead/cli/app_test.rb +12 -12
  51. data/test/lazylead/exchange_test.rb +3 -3
  52. data/test/lazylead/model_test.rb +4 -4
  53. data/test/lazylead/opts_test.rb +70 -0
  54. data/test/lazylead/postman_test.rb +1 -1
  55. data/test/lazylead/smtp_test.rb +1 -1
  56. data/test/lazylead/system/jira_test.rb +65 -1
  57. data/test/lazylead/task/accuracy/accuracy_test.rb +73 -0
  58. data/test/lazylead/task/accuracy/affected_build_test.rb +42 -0
  59. data/test/lazylead/task/accuracy/attachment_test.rb +50 -0
  60. data/test/lazylead/task/accuracy/environment_test.rb +42 -0
  61. data/test/lazylead/task/accuracy/logs_test.rb +78 -0
  62. data/test/lazylead/task/accuracy/records_test.rb +60 -0
  63. data/test/lazylead/task/accuracy/servers_test.rb +66 -0
  64. data/test/lazylead/task/accuracy/stacktrace_test.rb +113 -0
  65. data/test/lazylead/task/accuracy/testcase_test.rb +205 -0
  66. data/test/lazylead/task/accuracy/wiki_test.rb +40 -0
  67. data/test/lazylead/task/assignee_alert_test.rb +2 -2
  68. data/test/lazylead/task/duedate_test.rb +36 -26
  69. data/test/lazylead/task/fix_version_test.rb +9 -6
  70. data/test/lazylead/task/missing_comment_test.rb +11 -9
  71. data/test/lazylead/task/propagate_down_test.rb +4 -2
  72. data/test/lazylead/task/touch_test.rb +88 -0
  73. data/test/test.rb +25 -0
  74. data/upgrades/sqlite/001-install-main-lazylead-tables.sql +1 -5
  75. data/upgrades/sqlite/999.testdata.sql +12 -16
  76. metadata +65 -8
  77. data/.travis.yml +0 -16
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2020 Yurii Dubinka
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"),
9
+ # to deal in the Software without restriction, including without limitation
10
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ # and/or sell copies of the Software, and to permit persons to whom
12
+ # the Software is furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included
15
+ # in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
+ # OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ require_relative "../test"
26
+ require_relative "../../lib/lazylead/opts"
27
+
28
+ module Lazylead
29
+ class OptsTest < Lazylead::Test
30
+ test "able to read by symbol" do
31
+ assert_equal "1", Opts.new(one: "1", two: "2")[:one]
32
+ end
33
+
34
+ test "able to read by key" do
35
+ assert_equal "1", Opts.new("one" => "1", two: "2")["one"]
36
+ end
37
+
38
+ test "able to write by key" do
39
+ opts = Opts.new
40
+ opts["key"] = "value"
41
+ assert_equal "value", opts["key"]
42
+ end
43
+
44
+ test "has jira defaults" do
45
+ assert_entries(
46
+ {
47
+ max_results: 50
48
+ },
49
+ Opts.new.jira_defaults
50
+ )
51
+ end
52
+
53
+ test "split and trim" do
54
+ assert_equal %w[one two three],
55
+ Opts.new("text" => " one,two ,three, ,\n").slice("text", ",")
56
+ end
57
+
58
+ test "blank for null value cases" do
59
+ assert Opts.new("one" => "1", "two" => nil).blank? "two"
60
+ end
61
+
62
+ test "to hash" do
63
+ assert_kind_of Hash, Opts.new("one" => "1", "two" => nil).to_h
64
+ end
65
+
66
+ test "except keys" do
67
+ assert_equal 1, Opts.new("one" => "1", "two" => "2").except("one").size
68
+ end
69
+ end
70
+ end
@@ -38,7 +38,7 @@ module Lazylead
38
38
  "LL_SMTP_TO",
39
39
  "LL_SMTP_FROM"
40
40
  Smtp.new(
41
- Log::NOTHING,
41
+ Log.new,
42
42
  NoSalt.new,
43
43
  smtp_host: ENV["LL_SMTP_HOST"],
44
44
  smtp_port: ENV["LL_SMTP_PORT"],
@@ -48,7 +48,7 @@ module Lazylead
48
48
  test "email has been sent to the remote server" do
49
49
  skip "Not implemented yet" unless env? "LL_SMTP_HOST", "LL_SMTP_USER"
50
50
  Smtp.new(
51
- Log::NOTHING, NoSalt.new,
51
+ Log.new, NoSalt.new,
52
52
  smtp_host: ENV["LL_SMTP_HOST"],
53
53
  smtp_port: ENV["LL_SMTP_PORT"],
54
54
  smtp_user: ENV["LL_SMTP_USER"],
@@ -40,7 +40,7 @@ module Lazylead
40
40
 
41
41
  test "found issue by jira (ORM)" do
42
42
  skip "No Jira credentials provided" unless env? "jsi_usr", "jsi_psw"
43
- CLI::App.new(Log::NOTHING, NoSchedule.new).run(
43
+ CLI::App.new(Log.new, NoSchedule.new).run(
44
44
  home: ".",
45
45
  sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
46
46
  vcs4sql: "upgrades/sqlite",
@@ -114,5 +114,69 @@ module Lazylead
114
114
  .first
115
115
  .status
116
116
  end
117
+
118
+ test "issue has 1 field" do
119
+ assert_equal 1,
120
+ NoAuthJira.new("https://jira.spring.io")
121
+ .issues("key='DATAJDBC-480'", fields: ["summary"])
122
+ .first
123
+ .fields
124
+ .size
125
+ end
126
+
127
+ test "make an jira comment" do
128
+ issue = Struct.new(:comment) do
129
+ def comments
130
+ self
131
+ end
132
+
133
+ def build
134
+ self
135
+ end
136
+
137
+ def save!(body)
138
+ self[:comment] = body
139
+ end
140
+ end.new
141
+ Issue.new(issue, Fake.new).post("Hi there!")
142
+ assert_equal "Hi there!", issue.comment[:body]
143
+ end
144
+
145
+ test "search by limit in 1 issue" do
146
+ assert_equal 1,
147
+ NoAuthJira.new("https://jira.spring.io")
148
+ .issues("key in (DATAJDBC-480, DATAJDBC-500)", max_results: "1")
149
+ .size
150
+ end
151
+
152
+ test "description is correct" do
153
+ assert_words %w[DATACMNS-1639\ moved\ entity\ instantiators],
154
+ NoAuthJira.new("https://jira.spring.io")
155
+ .issues("key=DATAJDBC-480")
156
+ .first
157
+ .description
158
+ end
159
+
160
+ test "component is correct" do
161
+ assert_equal %w[Stream\ Module],
162
+ NoAuthJira.new("https://jira.spring.io")
163
+ .issues("key=XD-3766")
164
+ .first
165
+ .components
166
+ end
167
+
168
+ test "field found" do
169
+ assert_includes NoAuthJira.new("https://jira.spring.io")
170
+ .issues("key=DATAJDBC-480")
171
+ .first["description"],
172
+ "DATACMNS-1639 moved "
173
+ end
174
+
175
+ test "field not found" do
176
+ assert NoAuthJira.new("https://jira.spring.io")
177
+ .issues("key=DATAJDBC-480")
178
+ .first["absent field"]
179
+ .blank?
180
+ end
117
181
  end
118
182
  end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2020 Yurii Dubinka
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"),
9
+ # to deal in the Software without restriction, including without limitation
10
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ # and/or sell copies of the Software, and to permit persons to whom
12
+ # the Software is furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included
15
+ # in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
+ # OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ require_relative "../../../test"
26
+ require_relative "../../../../lib/lazylead/smtp"
27
+ require_relative "../../../../lib/lazylead/task/accuracy/accuracy"
28
+ require_relative "../../../../lib/lazylead/opts"
29
+ require_relative "../../../../lib/lazylead/postman"
30
+ require_relative "../../../../lib/lazylead/cli/app"
31
+ require_relative "../../../../lib/lazylead/system/jira"
32
+
33
+ module Lazylead
34
+ class AccuracyTest < Lazylead::Test
35
+ test "detect affected build" do
36
+ Lazylead::Smtp.new.enable
37
+ Task::Accuracy.new.run(
38
+ NoAuthJira.new("https://jira.spring.io"),
39
+ Postman.new,
40
+ Opts.new(
41
+ "from" => "ll@fake.com",
42
+ "to" => "lead@fake.com",
43
+ "rules" => "Lazylead::AffectedBuild",
44
+ "silent" => "true",
45
+ "colors" => {
46
+ "0" => "#FF4F33",
47
+ "35" => "#FF9F33",
48
+ "57" => "#19DD1E",
49
+ "90" => "#0FA81A"
50
+ }.to_json.to_s,
51
+ "docs" => "https://github.com/dgroup/lazylead/blob/master/.github/ISSUE_TEMPLATE/bug_report.md",
52
+ "jql" => "key in (DATAJDBC-490, DATAJDBC-492, DATAJDBC-493)",
53
+ "max_results" => 200,
54
+ "subject" => "[LL] Raised tickets",
55
+ "template" => "lib/messages/accuracy.erb"
56
+ )
57
+ )
58
+ assert_email "[LL] Raised tickets",
59
+ %w[DATAJDBC-493 0.5 100% MyeongHyeonLee Deadlock\ occurs]
60
+ end
61
+
62
+ test "construct accuracy from orm" do
63
+ CLI::App.new(Log.new, NoSchedule.new).run(
64
+ home: ".",
65
+ sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
66
+ vcs4sql: "upgrades/sqlite",
67
+ testdata: true
68
+ )
69
+ assert_kind_of Lazylead::Task::Accuracy,
70
+ ORM::Task.find(195).action.constantize.new
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2020 Yurii Dubinka
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"),
9
+ # to deal in the Software without restriction, including without limitation
10
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ # and/or sell copies of the Software, and to permit persons to whom
12
+ # the Software is furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included
15
+ # in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
+ # OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ require_relative "../../../test"
26
+ require_relative "../../../../lib/lazylead/task/accuracy/affected_build"
27
+
28
+ module Lazylead
29
+ class AffectedBuildTest < Lazylead::Test
30
+ test "affected version absent" do
31
+ refute AffectedBuild.new.passed(
32
+ OpenStruct.new(fields: { "versions" => [] })
33
+ )
34
+ end
35
+
36
+ test "affected version provided" do
37
+ assert AffectedBuild.new.passed(
38
+ OpenStruct.new(fields: { "versions" => ["0.4.0"] })
39
+ )
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2020 Yurii Dubinka
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"),
9
+ # to deal in the Software without restriction, including without limitation
10
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ # and/or sell copies of the Software, and to permit persons to whom
12
+ # the Software is furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included
15
+ # in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
+ # OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ require_relative "../../../test"
26
+ require_relative "../../../../lib/lazylead/log"
27
+ require_relative "../../../../lib/lazylead/system/jira"
28
+ require_relative "../../../../lib/lazylead/task/accuracy/attachment"
29
+
30
+ module Lazylead
31
+ class AttachmentTest < Lazylead::Test
32
+ class Txt < Attachment
33
+ def initialize
34
+ super "", 0, ""
35
+ end
36
+
37
+ def matching(attach)
38
+ "ConfigServerLogWithException.txt".eql? attach.attrs["filename"]
39
+ end
40
+ end
41
+
42
+ test "attachment is present" do
43
+ assert Txt.new.passed(
44
+ NoAuthJira.new("https://jira.spring.io")
45
+ .issues("key=XD-3761", fields: ["attachment"])
46
+ .first
47
+ )
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2020 Yurii Dubinka
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"),
9
+ # to deal in the Software without restriction, including without limitation
10
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ # and/or sell copies of the Software, and to permit persons to whom
12
+ # the Software is furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included
15
+ # in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
+ # OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ require_relative "../../../test"
26
+ require_relative "../../../../lib/lazylead/task/accuracy/environment"
27
+
28
+ module Lazylead
29
+ class EnvironmentTest < Lazylead::Test
30
+ test "environment absent" do
31
+ refute Environment.new.passed(
32
+ OpenStruct.new(fields: { "environment" => "" })
33
+ )
34
+ end
35
+
36
+ test "environment provided" do
37
+ assert Environment.new.passed(
38
+ OpenStruct.new(fields: { "environment" => "http://host:port" })
39
+ )
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2020 Yurii Dubinka
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"),
9
+ # to deal in the Software without restriction, including without limitation
10
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ # and/or sell copies of the Software, and to permit persons to whom
12
+ # the Software is furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included
15
+ # in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
+ # OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ require_relative "../../../test"
26
+ require_relative "../../../../lib/lazylead/task/accuracy/logs"
27
+
28
+ module Lazylead
29
+ class LogsTest < Lazylead::Test
30
+ test "log file is present" do
31
+ assert Logs.new.passed(
32
+ OpenStruct.new(
33
+ attachments: [
34
+ OpenStruct.new(
35
+ attrs: { "size" => 10_241, "filename" => "catalina.log" }
36
+ )
37
+ ]
38
+ )
39
+ )
40
+ end
41
+
42
+ test "log file is present but name in uppercase" do
43
+ assert Logs.new.passed(
44
+ OpenStruct.new(
45
+ attachments: [
46
+ OpenStruct.new(
47
+ attrs: { "size" => 10_241, "filename" => "catalina.LOG" }
48
+ )
49
+ ]
50
+ )
51
+ )
52
+ end
53
+
54
+ test "attachment isn't a log file" do
55
+ refute Logs.new.passed(
56
+ OpenStruct.new(
57
+ attachments: [
58
+ OpenStruct.new(
59
+ attrs: { "size" => 10_001, "filename" => "readme.md" }
60
+ )
61
+ ]
62
+ )
63
+ )
64
+ end
65
+
66
+ test "log file size less than 10KB" do
67
+ refute Logs.new.passed(
68
+ OpenStruct.new(
69
+ attachments: [
70
+ OpenStruct.new(
71
+ attrs: { "size" => 10_000, "filename" => "catalina.log" }
72
+ )
73
+ ]
74
+ )
75
+ )
76
+ end
77
+ end
78
+ end