anyt-core 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5abc6a66da48cd93e93f47f95c6e9611856c19e470cc8342934c1d9b7582214
4
- data.tar.gz: 2bf91947847c7b71ccb44b4c3988e237309eb5c063f74201bb71be3d41a2f5b9
3
+ metadata.gz: 158d005ccb552a059df74166a759a51fc982666cebc182b80d7dda37454c6717
4
+ data.tar.gz: 8ef8e1730ec753e623be8f20eadc86b572bc6b935261e855316200d060234115
5
5
  SHA512:
6
- metadata.gz: cad2ec2427b323b82e97f1a4a8894cb04f1db45034880007b7b120db401af929b738ac0b8274f4dcfe462dee136bbafd3996afe45230135f567a2c2c97c55c65
7
- data.tar.gz: 3b92c26e7c2347e8e3452928e17a85c7a70d1b9ed862f25513cd15e3ffafb1665ac9d9fdd9bdf041b51df0a0360742d0351680136a9cab2b0f1105d6c3beacca
6
+ metadata.gz: 61800da6022b7e877ae71cc7a4b98a09e3e7c3cab36df7d4f03c1e8c53ec439fd27d034968ff46c634ee294ac8eed83902f05b6098710cd0174ddbdc43e7694c
7
+ data.tar.gz: d78be5f00123db956c42a87aa8315b63d7b8ce52c8c5cd7fa33865ff7ce36a3408f8a6f7b11be356c081e013251e2de54dfb2339cea685745baa6a034d6d07a9
data/lib/anyt/cli.rb CHANGED
@@ -25,6 +25,12 @@ module Anyt
25
25
  def run(args = ARGV)
26
26
  parse_options!(args)
27
27
 
28
+ if Anyt.config.list_tests
29
+ Tests.load_tests
30
+ Tests.list
31
+ return 0
32
+ end
33
+
28
34
  ActionCable.server.config.logger = Rails.logger = AnyCable.logger
29
35
 
30
36
  result = 1
@@ -128,6 +134,11 @@ module Anyt
128
134
  configure_rails_command!
129
135
  end
130
136
 
137
+ cli.on("-l", "--list", TrueClass, "List test scenarios") do
138
+ Anyt.config.list_tests = true
139
+ @skip_rpc = true
140
+ end
141
+
131
142
  cli.on("--self-check", "Run tests again Action Cable itself") do
132
143
  @skip_rpc = true
133
144
 
@@ -142,6 +153,10 @@ module Anyt
142
153
  Anyt.config.except_tests = except_tests
143
154
  end
144
155
 
156
+ cli.on("-e filter", "Run only tests matching the descripton") do |filter_tests|
157
+ Anyt.config.filter_tests = filter_tests
158
+ end
159
+
145
160
  cli.on("--wait-command=TIMEOUT", Integer,
146
161
  "Number of seconds to wait for WS server initialization") do |timeout|
147
162
  Anyt.config.wait_command = timeout
data/lib/anyt/config.rb CHANGED
@@ -8,6 +8,8 @@ module Anyt
8
8
  attr_config :command,
9
9
  :only_tests,
10
10
  :except_tests,
11
+ :filter_tests,
12
+ :list_tests,
11
13
  :tests_relative_path,
12
14
  remote_control_port: 8919,
13
15
  use_action_cable: false,
@@ -37,5 +39,11 @@ module Anyt
37
39
  (except_rxp.nil? || !except_rxp.match?(path))
38
40
  end
39
41
  end
42
+
43
+ def example_filter
44
+ return unless filter_tests
45
+
46
+ /#{filter_tests}/i
47
+ end
40
48
  end
41
49
  end
@@ -55,8 +55,10 @@ class BenchmarkChannel < ApplicationCable::Channel
55
55
  end
56
56
 
57
57
  def echo(data)
58
- if ECHO_DELAY > 0
59
- sleep ECHO_DELAY
58
+ puts "ECHO: #{data.inspect}" if data["verbose"]
59
+ delay = data.fetch("delay", ECHO_DELAY).to_f
60
+ if delay > 0
61
+ sleep delay
60
62
  end
61
63
  transmit data
62
64
  end
@@ -96,6 +96,9 @@ module Minitest::Spec::DSL
96
96
  # Simplified version of `it` which doesn't care
97
97
  # about unique method names
98
98
  def scenario(desc, &block)
99
+ full_desc = "#{name.gsub("\n", " ").strip} #{desc.gsub("\n", " ").strip}"
100
+ return if Anyt.config.example_filter && !Anyt.config.example_filter.match?(full_desc)
101
+
99
102
  block ||= proc { skip "(no tests defined)" }
100
103
 
101
104
  define_method "test_ #{desc}", &block
data/lib/anyt/tests.rb CHANGED
@@ -17,9 +17,29 @@ module Anyt
17
17
  Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
18
18
 
19
19
  AnyCable.logger.debug "Run tests against: #{Anyt.config.target_url}"
20
+
20
21
  Minitest.run
21
22
  end
22
23
 
24
+ def list
25
+ printer = Object.new
26
+ printer.extend include ANSI::Code
27
+
28
+ Minitest::Runnable.runnables.each do |runnable|
29
+ def runnable.test_order
30
+ :sorted
31
+ end
32
+ next unless runnable.runnable_methods.any?
33
+
34
+ $stdout.puts(runnable.name)
35
+
36
+ runnable.runnable_methods.each do |method|
37
+ test_name = method.gsub(/^test_/, "").strip
38
+ $stdout.puts(printer.magenta { " #{test_name}" })
39
+ end
40
+ end
41
+ end
42
+
23
43
  # Load tests code (filtered if present)
24
44
  #
25
45
  # NOTE: We should run this before launching RPC server
data/lib/anyt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anyt
4
- VERSION = "1.3.1"
4
+ VERSION = "1.4.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anyt-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-08 00:00:00.000000000 Z
11
+ date: 2024-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
162
  requirements: []
163
- rubygems_version: 3.4.20
163
+ rubygems_version: 3.5.18
164
164
  signing_key:
165
165
  specification_version: 4
166
166
  summary: Action Cable / AnyCable conformance testing tool