lazylead 0.10.2 → 0.11.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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/.githooks/commit-msg +13 -0
  3. data/.rultor.yml +1 -0
  4. data/Rakefile +9 -1
  5. data/lazylead.gemspec +8 -7
  6. data/lib/lazylead/cli/app.rb +1 -1
  7. data/lib/lazylead/model.rb +24 -3
  8. data/lib/lazylead/opts.rb +11 -0
  9. data/lib/lazylead/schedule.rb +8 -1
  10. data/lib/lazylead/system/jira.rb +4 -3
  11. data/lib/lazylead/task/accuracy/accuracy.rb +32 -4
  12. data/lib/lazylead/task/accuracy/has_label.rb +48 -0
  13. data/lib/lazylead/task/accuracy/logs_link.rb +2 -2
  14. data/lib/lazylead/task/accuracy/memes.rb +77 -0
  15. data/lib/lazylead/task/accuracy/records.rb +3 -1
  16. data/lib/lazylead/task/accuracy/records_link.rb +49 -0
  17. data/lib/lazylead/task/accuracy/wiki_url.rb +46 -0
  18. data/lib/lazylead/version.rb +1 -1
  19. data/lib/messages/svn_grep.erb +1 -0
  20. data/test/lazylead/exchange_test.rb +21 -14
  21. data/test/lazylead/opts_test.rb +16 -0
  22. data/test/lazylead/retry_test.rb +85 -0
  23. data/test/lazylead/system/jira_test.rb +13 -5
  24. data/test/lazylead/task/accuracy/accuracy_test.rb +5 -0
  25. data/test/lazylead/task/accuracy/has_label_test.rb +54 -0
  26. data/test/lazylead/task/accuracy/memes_test.rb +77 -0
  27. data/test/lazylead/task/accuracy/records_llink_test.rb +55 -0
  28. data/test/lazylead/task/accuracy/records_test.rb +16 -0
  29. data/test/lazylead/task/accuracy/score_test.rb +7 -0
  30. data/test/lazylead/task/accuracy/screenshots_test.rb +2 -0
  31. data/test/lazylead/task/accuracy/wiki_url_test.rb +58 -0
  32. data/test/lazylead/task/svn/grep_test.rb +1 -2
  33. data/test/lazylead/task/svn/touch_test.rb +1 -1
  34. data/test/sqlite_test.rb +1 -1
  35. data/test/test.rb +47 -0
  36. metadata +42 -13
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2021 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/records_link"
27
+
28
+ module Lazylead
29
+ class RecordsTest < Lazylead::Test
30
+ test "log file is present and link is absent" do
31
+ assert RecordsLink.new("https://youtube.com/xyz").passed(
32
+ OpenStruct.new(
33
+ attachments: [OpenStruct.new(attrs: { "size" => 10_241, "filename" => "steps.mp4" })]
34
+ )
35
+ )
36
+ end
37
+
38
+ test "file is absent but description has url to video" do
39
+ assert RecordsLink.new("https://youtube.com/xyz").passed(
40
+ OpenStruct.new(description: "Here is the reproducing steps: https://youtube.com/xyzzzzz")
41
+ )
42
+ end
43
+
44
+ test "several base urls to video" do
45
+ assert RecordsLink.new("https://site.a.com/xyz", "http://site.b.com/zyx").passed(
46
+ OpenStruct.new(description: "Here is the reproducing steps: http://site.b.com/zyx123. Wow!")
47
+ )
48
+ end
49
+
50
+ test "file is absent and link is absent" do
51
+ refute RecordsLink.new("https://youtube.com/xyz")
52
+ .passed(OpenStruct.new(attachments: []))
53
+ end
54
+ end
55
+ end
@@ -24,6 +24,7 @@
24
24
 
25
25
  require_relative "../../../test"
26
26
  require_relative "../../../../lib/lazylead/task/accuracy/records"
27
+ require_relative "../../../../lib/lazylead/system/jira"
27
28
 
28
29
  module Lazylead
29
30
  class RecordsTest < Lazylead::Test
@@ -56,5 +57,20 @@ module Lazylead
56
57
  )
57
58
  )
58
59
  end
60
+
61
+ test "mime type has .gif despite on ext" do
62
+ assert Records.new.passed(
63
+ OpenStruct.new(
64
+ attachments: [
65
+ OpenStruct.new(
66
+ attrs: {
67
+ "filename" => "snapshot.png",
68
+ "mimeType" => "image/gif"
69
+ }
70
+ )
71
+ ]
72
+ )
73
+ )
74
+ end
59
75
  end
60
76
  end
@@ -66,6 +66,13 @@ module Lazylead
66
66
  "57" => "#19DD1E",
67
67
  "90" => "#0FA81A"
68
68
  }.to_json.to_s,
69
+ memes: Memes.new(
70
+ {
71
+ "0-9.9" => "https://meme.com?id=awful1.gif,https://meme.com?id=awful2.gif",
72
+ "70-89.9" => "https://meme.com?id=nice.gif",
73
+ "90-100" => "https://meme.com?id=wow.gif"
74
+ }.to_json.to_s
75
+ ),
69
76
  "docs" => "https://github.com/dgroup/lazylead/blob/master/.github/ISSUE_TEMPLATE/bug_report.md"
70
77
  )
71
78
  ).evaluate.comment
@@ -27,6 +27,8 @@ require_relative "../../../../lib/lazylead/task/accuracy/screenshots"
27
27
  require_relative "../../../../lib/lazylead/system/jira"
28
28
 
29
29
  module Lazylead
30
+ # @todo #/DEV Rename the tests name as some of them are too huge.
31
+ # The maximum name size should be 56 symbols as it gives fancy format for test output in terminal
30
32
  class ScreenshotsTest < Lazylead::Test
31
33
  test "issue has two .png files with reference in description" do
32
34
  assert Screenshots.new.passed(
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2021 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/wiki_url"
27
+
28
+ module Lazylead
29
+ class WikiUrlTest < Lazylead::Test
30
+ test "wiki reference is present as url" do
31
+ assert WikiUrl.new("https://wiki.com/page=").passed(
32
+ OpenStruct.new(
33
+ remote_links: [
34
+ OpenStruct.new(
35
+ attrs: { "object" => { "url" => "https://wiki.com/page=5" } }
36
+ )
37
+ ]
38
+ )
39
+ )
40
+ end
41
+
42
+ test "wiki reference is absent as url" do
43
+ refute WikiUrl.new("https://wiki.com/page=").passed(
44
+ OpenStruct.new(
45
+ remote_links: [
46
+ OpenStruct.new(
47
+ attrs: {}
48
+ )
49
+ ]
50
+ )
51
+ )
52
+ end
53
+
54
+ test "wiki score" do
55
+ greater_then WikiUrl.new("https://wiki.com/page=").score, 0
56
+ end
57
+ end
58
+ end
@@ -33,8 +33,7 @@ require_relative "../../../../lib/lazylead/task/svn/svn"
33
33
  module Lazylead
34
34
  class GrepTest < Lazylead::Test
35
35
  test "changes with text" do
36
- skip "No svn credentials provided" unless env? "svn_log_user",
37
- "svn_log_password"
36
+ skip "No svn credentials provided" unless env? "svn_log_user", "svn_log_password"
38
37
  skip "No internet connection to riouxsvn.com" unless ping? "riouxsvn.com"
39
38
  Lazylead::Smtp.new.enable
40
39
  Task::Svn::Grep.new.run(
@@ -55,7 +55,7 @@ module Lazylead
55
55
  )
56
56
  )
57
57
  assert_email "[SVN] Important files have been changed!",
58
- %w[3 dgroup /189.md Add\ description\ for\ 189\ issue]
58
+ ["3", "dgroup", "/189.md", "Add description for 189 issue"]
59
59
  end
60
60
  end
61
61
  end
data/test/sqlite_test.rb CHANGED
@@ -46,7 +46,7 @@ module Lazylead
46
46
  tbl = t.first.to_s
47
47
  cols = t.values_at(1).sort.join(",")
48
48
  raise "No columns found for table #{tbl} in #{tables}" if cols.empty?
49
- refute schema[tbl].nil?, "Table '#{tbl}' not found in #{schema}"
49
+ refute_nil schema[tbl], "Table '#{tbl}' not found in #{schema}"
50
50
  assert_equal cols, schema[tbl], "Columns mismatch for '#{tbl}'"
51
51
  end
52
52
  end
data/test/test.rb CHANGED
@@ -51,6 +51,15 @@ module Lazylead
51
51
  include Minitest::Hooks
52
52
 
53
53
  make_my_diffs_pretty!
54
+ parallelize(workers: ENV["MT_CPU"].to_i)
55
+
56
+ parallelize_setup do |worker|
57
+ SimpleCov.command_name "#{SimpleCov.command_name}-#{worker}"
58
+ end
59
+
60
+ parallelize_teardown do |_worker|
61
+ SimpleCov.result
62
+ end
54
63
 
55
64
  def around
56
65
  Timeout.timeout(
@@ -147,5 +156,43 @@ module Lazylead
147
156
  require "net/ping"
148
157
  Net::Ping::External.new(host).ping?
149
158
  end
159
+
160
+ # Ensure that actual array contain at least expected array.
161
+ # @param exp
162
+ # The array with expected values
163
+ # @param act
164
+ # The array with actual values
165
+ def assert_array(exp, act)
166
+ assert_equal exp.size, act.size, "Size mismatch between arrays"
167
+ assert array?(exp, act), "No match between '#{exp}' and '#{act}'"
168
+ end
169
+
170
+ # Compare that actual array contain(not equal!) at least expected array.
171
+ # @return true
172
+ # If array <exp> contain array <act>
173
+ # rubocop:disable Metrics/PerceivedComplexity
174
+ # rubocop:disable Metrics/CyclomaticComplexity
175
+ def array?(exp, act)
176
+ rows = []
177
+ exp.each do |row|
178
+ rows << if row.respond_to? :each
179
+ act.any? do |arow|
180
+ next unless arow.respond_to? :[]
181
+ row.each_with_index.map { |c, i| c.eql? arow[i] }.all? { |c| c }
182
+ end
183
+ else
184
+ act.any? { |arow| row.eql? arow }
185
+ end
186
+ end
187
+ rows.all? { |r| r }
188
+ end
189
+ # rubocop:enable Metrics/PerceivedComplexity
190
+ # rubocop:enable Metrics/CyclomaticComplexity
191
+
192
+ # Ensure that text is blank.
193
+ def assert_blank(text)
194
+ assert_respond_to text, :blank?, "Text has no method :blank?"
195
+ assert text.blank?, "Text isn't blank"
196
+ end
150
197
  end
151
198
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazylead
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yurii Dubinka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-22 00:00:00.000000000 Z
11
+ date: 2021-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 1.5.1
61
+ version: 1.7.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 1.5.1
68
+ version: 1.7.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: get_process_mem
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - '='
165
165
  - !ruby/object:Gem::Version
166
166
  version: 1.0.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: nokogiri
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '='
172
+ - !ruby/object:Gem::Version
173
+ version: 1.11.3
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - '='
179
+ - !ruby/object:Gem::Version
180
+ version: 1.11.3
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: openssl
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -352,14 +366,14 @@ dependencies:
352
366
  requirements:
353
367
  - - '='
354
368
  - !ruby/object:Gem::Version
355
- version: 0.5.2
369
+ version: 0.6.0
356
370
  type: :development
357
371
  prerelease: false
358
372
  version_requirements: !ruby/object:Gem::Requirement
359
373
  requirements:
360
374
  - - '='
361
375
  - !ruby/object:Gem::Version
362
- version: 0.5.2
376
+ version: 0.6.0
363
377
  - !ruby/object:Gem::Dependency
364
378
  name: guard
365
379
  requirement: !ruby/object:Gem::Requirement
@@ -506,42 +520,42 @@ dependencies:
506
520
  requirements:
507
521
  - - '='
508
522
  - !ruby/object:Gem::Version
509
- version: 1.18.3
523
+ version: 1.20.0
510
524
  type: :development
511
525
  prerelease: false
512
526
  version_requirements: !ruby/object:Gem::Requirement
513
527
  requirements:
514
528
  - - '='
515
529
  - !ruby/object:Gem::Version
516
- version: 1.18.3
530
+ version: 1.20.0
517
531
  - !ruby/object:Gem::Dependency
518
532
  name: rubocop-minitest
519
533
  requirement: !ruby/object:Gem::Requirement
520
534
  requirements:
521
535
  - - '='
522
536
  - !ruby/object:Gem::Version
523
- version: 0.14.0
537
+ version: 0.15.0
524
538
  type: :development
525
539
  prerelease: false
526
540
  version_requirements: !ruby/object:Gem::Requirement
527
541
  requirements:
528
542
  - - '='
529
543
  - !ruby/object:Gem::Version
530
- version: 0.14.0
544
+ version: 0.15.0
531
545
  - !ruby/object:Gem::Dependency
532
546
  name: rubocop-performance
533
547
  requirement: !ruby/object:Gem::Requirement
534
548
  requirements:
535
549
  - - '='
536
550
  - !ruby/object:Gem::Version
537
- version: 1.11.4
551
+ version: 1.11.5
538
552
  type: :development
539
553
  prerelease: false
540
554
  version_requirements: !ruby/object:Gem::Requirement
541
555
  requirements:
542
556
  - - '='
543
557
  - !ruby/object:Gem::Version
544
- version: 1.11.4
558
+ version: 1.11.5
545
559
  - !ruby/object:Gem::Dependency
546
560
  name: rubocop-rake
547
561
  requirement: !ruby/object:Gem::Requirement
@@ -645,6 +659,7 @@ files:
645
659
  - ".docs/duedate_expired.md"
646
660
  - ".docs/propagate_down.md"
647
661
  - ".gitattributes"
662
+ - ".githooks/commit-msg"
648
663
  - ".github/CODE_OF_CONDUCT.md"
649
664
  - ".github/CONTRIBUTING.md"
650
665
  - ".github/ISSUE_TEMPLATE.md"
@@ -693,10 +708,13 @@ files:
693
708
  - lib/lazylead/task/accuracy/affected_build.rb
694
709
  - lib/lazylead/task/accuracy/attachment.rb
695
710
  - lib/lazylead/task/accuracy/environment.rb
711
+ - lib/lazylead/task/accuracy/has_label.rb
696
712
  - lib/lazylead/task/accuracy/logs.rb
697
713
  - lib/lazylead/task/accuracy/logs_link.rb
714
+ - lib/lazylead/task/accuracy/memes.rb
698
715
  - lib/lazylead/task/accuracy/onlyll.rb
699
716
  - lib/lazylead/task/accuracy/records.rb
717
+ - lib/lazylead/task/accuracy/records_link.rb
700
718
  - lib/lazylead/task/accuracy/required.rb
701
719
  - lib/lazylead/task/accuracy/requirement.rb
702
720
  - lib/lazylead/task/accuracy/screenshots.rb
@@ -704,6 +722,7 @@ files:
704
722
  - lib/lazylead/task/accuracy/stacktrace.rb
705
723
  - lib/lazylead/task/accuracy/testcase.rb
706
724
  - lib/lazylead/task/accuracy/wiki.rb
725
+ - lib/lazylead/task/accuracy/wiki_url.rb
707
726
  - lib/lazylead/task/alert/alert.rb
708
727
  - lib/lazylead/task/alert/alertif.rb
709
728
  - lib/lazylead/task/alert/changed_to.rb
@@ -746,6 +765,7 @@ files:
746
765
  - test/lazylead/model_test.rb
747
766
  - test/lazylead/opts_test.rb
748
767
  - test/lazylead/postman_test.rb
768
+ - test/lazylead/retry_test.rb
749
769
  - test/lazylead/salt_test.rb
750
770
  - test/lazylead/smoke_test.rb
751
771
  - test/lazylead/smtp_test.rb
@@ -754,9 +774,12 @@ files:
754
774
  - test/lazylead/task/accuracy/affected_build_test.rb
755
775
  - test/lazylead/task/accuracy/attachment_test.rb
756
776
  - test/lazylead/task/accuracy/environment_test.rb
777
+ - test/lazylead/task/accuracy/has_label_test.rb
757
778
  - test/lazylead/task/accuracy/logs_link_test.rb
758
779
  - test/lazylead/task/accuracy/logs_test.rb
780
+ - test/lazylead/task/accuracy/memes_test.rb
759
781
  - test/lazylead/task/accuracy/onlyll_test.rb
782
+ - test/lazylead/task/accuracy/records_llink_test.rb
760
783
  - test/lazylead/task/accuracy/records_test.rb
761
784
  - test/lazylead/task/accuracy/score_test.rb
762
785
  - test/lazylead/task/accuracy/screenshots_test.rb
@@ -764,6 +787,7 @@ files:
764
787
  - test/lazylead/task/accuracy/stacktrace_test.rb
765
788
  - test/lazylead/task/accuracy/testcase_test.rb
766
789
  - test/lazylead/task/accuracy/wiki_test.rb
790
+ - test/lazylead/task/accuracy/wiki_url_test.rb
767
791
  - test/lazylead/task/alert/alertif_test.rb
768
792
  - test/lazylead/task/alert/assignee_alert_test.rb
769
793
  - test/lazylead/task/alert/changed_to_test.rb
@@ -791,7 +815,7 @@ licenses:
791
815
  - MIT
792
816
  metadata: {}
793
817
  post_install_message: |-
794
- Thanks for installing Lazylead v0.10.2!
818
+ Thanks for installing Lazylead v0.11.0!
795
819
  Read our blog posts: https://lazylead.org
796
820
  Stay in touch with the community in Telegram: https://t.me/lazylead
797
821
  Follow us on Twitter: https://twitter.com/lazylead
@@ -824,6 +848,7 @@ test_files:
824
848
  - test/lazylead/model_test.rb
825
849
  - test/lazylead/opts_test.rb
826
850
  - test/lazylead/postman_test.rb
851
+ - test/lazylead/retry_test.rb
827
852
  - test/lazylead/salt_test.rb
828
853
  - test/lazylead/smoke_test.rb
829
854
  - test/lazylead/smtp_test.rb
@@ -832,9 +857,12 @@ test_files:
832
857
  - test/lazylead/task/accuracy/affected_build_test.rb
833
858
  - test/lazylead/task/accuracy/attachment_test.rb
834
859
  - test/lazylead/task/accuracy/environment_test.rb
860
+ - test/lazylead/task/accuracy/has_label_test.rb
835
861
  - test/lazylead/task/accuracy/logs_link_test.rb
836
862
  - test/lazylead/task/accuracy/logs_test.rb
863
+ - test/lazylead/task/accuracy/memes_test.rb
837
864
  - test/lazylead/task/accuracy/onlyll_test.rb
865
+ - test/lazylead/task/accuracy/records_llink_test.rb
838
866
  - test/lazylead/task/accuracy/records_test.rb
839
867
  - test/lazylead/task/accuracy/score_test.rb
840
868
  - test/lazylead/task/accuracy/screenshots_test.rb
@@ -842,6 +870,7 @@ test_files:
842
870
  - test/lazylead/task/accuracy/stacktrace_test.rb
843
871
  - test/lazylead/task/accuracy/testcase_test.rb
844
872
  - test/lazylead/task/accuracy/wiki_test.rb
873
+ - test/lazylead/task/accuracy/wiki_url_test.rb
845
874
  - test/lazylead/task/alert/alertif_test.rb
846
875
  - test/lazylead/task/alert/assignee_alert_test.rb
847
876
  - test/lazylead/task/alert/changed_to_test.rb