knapsack_pro 0.41.0 → 0.42.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
  SHA1:
3
- metadata.gz: 13b0f54f8e0ffa8fa8a1dafac285ccdad9ee4559
4
- data.tar.gz: e7208a544178784df5dcfc4d00032f4333e22408
3
+ metadata.gz: 57d4426354fb25838c3bb77b4fca90389abe875b
4
+ data.tar.gz: b1099760fde424a458a77f6c405638c0658279b8
5
5
  SHA512:
6
- metadata.gz: 91ceb897da7ec79de2c86a8dc76298d4f9d3a091fe90a66657c3cb6a81b9188e613fcc65e3376309742922f3f0513e0b5f7a9d3b7ac0055febec6c31fb500994
7
- data.tar.gz: 0a7f9b2160f50e6423f2a58afb4fdf774e779524ab5f2a8efb6a6a8b0cee6ff9e97b859916ce27427eda5de6faf806bce2294a58f7ad19d57ebae7f166cdb1a4
6
+ metadata.gz: 623a862646a5e14aa0423a51b095569485d014a68c2b135756890465e94d3ec72aa5650a64133c143488d0bf7739dc169b902eff661bc3d59023062f9c7426b8
7
+ data.tar.gz: 37e03af1ea495e3d42eb0d5f75d0fdcc53d77d689fc317d7931c4692f0348b2fcf6e5a76dbfb21dd3469808b1576a23c8fb3376730841c4d6e2641a8324ef0b6
@@ -2,6 +2,14 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 0.42.0
6
+
7
+ * Clear RSpec examples without shared examples in similar way as in RSpec 3.6.0
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/42
10
+
11
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.41.0...v0.42.0
12
+
5
13
  ### 0.41.0
6
14
 
7
15
  * Add after subset queue hook and example how to use JUnit formatter in Queue Mode.
data/README.md CHANGED
@@ -103,6 +103,7 @@ The knapsack_pro has also [queue mode](#queue-mode) to get optimal test suite sp
103
103
  - [Common problems](#common-problems)
104
104
  - [Why I see API error commit_hash parameter is required?](#why-i-see-api-error-commit_hash-parameter-is-required)
105
105
  - [Queue Mode problems](#queue-mode-problems)
106
+ - [Why I don't see collected time execution data for my build in user dashboard?](#why-i-dont-see-collected-time-execution-data-for-my-build-in-user-dashboard)
106
107
  - [Why when I use Queue Mode for RSpec and test fails then I see multiple times info about failed test in RSpec result?](#why-when-i-use-queue-mode-for-rspec-and-test-fails-then-i-see-multiple-times-info-about-failed-test-in-rspec-result)
107
108
  - [Why when I use Queue Mode for RSpec then I see multiple times the same pending tests?](#why-when-i-use-queue-mode-for-rspec-then-i-see-multiple-times-the-same-pending-tests)
108
109
  - [Does in Queue Mode the RSpec is initialized many times that causes Rails load over and over again?](#does-in-queue-mode-the-rspec-is-initialized-many-times-that-causes-rails-load-over-and-over-again)
@@ -128,6 +129,7 @@ The knapsack_pro has also [queue mode](#queue-mode) to get optimal test suite sp
128
129
  - [How to set `before(:suite)` and `after(:suite)` RSpec hooks in Queue Mode (Percy.io example)?](#how-to-set-beforesuite-and-aftersuite-rspec-hooks-in-queue-mode-percyio-example)
129
130
  - [How to call `before(:suite)` and `after(:suite)` RSpec hooks only once in Queue Mode?](#how-to-call-beforesuite-and-aftersuite-rspec-hooks-only-once-in-queue-mode)
130
131
  - [How to run knapsack_pro with parallel_tests gem?](#how-to-run-knapsack_pro-with-parallel_tests-gem)
132
+ - [How to retry failed tests (flaky tests)?](#how-to-retry-failed-tests-flaky-tests)
131
133
  - [Questions around data usage and security](#questions-around-data-usage-and-security)
132
134
  - [What data is sent to your servers?](#what-data-is-sent-to-your-servers)
133
135
  - [How is that data secured?](#how-is-that-data-secured)
@@ -362,8 +364,12 @@ If above command fails then you may need to explicitly pass an argument to requi
362
364
  Note if you will run queue mode command for the first time it might be slower.
363
365
  The second build should have better optimal test suite split.
364
366
 
367
+ Please ensure you have explicitly set `RAILS_ENV=test` on your CI nodes.
368
+
365
369
  If you use capybara-screenshot gem then please [follow this step](#how-to-fix-capybara-screenshot-fail-with-systemstackerror-stack-level-too-deep-when-using-queue-mode-for-rspec).
366
370
 
371
+ If you use rspec_junit_formatter gem then please [follow this step](#how-to-use-junit-formatter-with-knapsack_pro-queue-mode).
372
+
367
373
  ### Additional info about queue mode
368
374
 
369
375
  * You should use different API token for queue mode than for regular mode to avoid problem with test suite split in case you would like to go back to regular mode.
@@ -856,6 +862,14 @@ knapack_pro gem cannot determine the git commit hash and branch name. To fix thi
856
862
 
857
863
  #### Queue Mode problems
858
864
 
865
+ ##### Why I don't see collected time execution data for my build in user dashboard?
866
+
867
+ If you go to [user dashboard](https://knapsackpro.com/dashboard) and open `Build metrics` for your API token and you open build for your last git commit you should see there info about collected time execution data from all CI nodes. If you don't see collected time execution data for CI nodes then please ensure:
868
+
869
+ * you have `Knapsack::Adapters::RspecAdapter.bind` in your `rails_helper.rb` or `spec_helper.rb`
870
+ * you explicitly set `RAILS_ENV=test` on your CI nodes (for instance you use Docker then please set `RAILS_ENV`)
871
+ * knapsack_pro Queue Mode saves temporary files with collected time execution data in `your_rails_project/tmp/knapsack_pro/queue/`. Please ensure you don't clean `tmp` directory in your tests so knapsack_pro can publish time execution data to Knapsack Pro API server.
872
+
859
873
  ##### Why when I use Queue Mode for RSpec and test fails then I see multiple times info about failed test in RSpec result?
860
874
 
861
875
  The problem may happen when you use old knapsack_pro `< 0.33.0` or if you use custom rspec formatter, or when you set flag [KNAPSACK_PRO_MODIFY_DEFAULT_RSPEC_FORMATTERS=false](#knapsack_pro_modify_default_rspec_formatters-hide-duplicated-summary-of-pending-and-failed-tests).
@@ -1268,6 +1282,30 @@ To ensure everything works you can check output for each CI node.
1268
1282
  (tests output here)
1269
1283
  ```
1270
1284
 
1285
+ #### How to retry failed tests (flaky tests)?
1286
+
1287
+ Flaky (nondeterministic) tests, are tests that exhibit both a passing and a failing result with the same code.
1288
+
1289
+ You can use [only failures option in RSpec](https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures) to rerun failed tests.
1290
+
1291
+ Please add to your RSpec configuration:
1292
+
1293
+ ```
1294
+ RSpec.configure do |c|
1295
+ c.example_status_persistence_file_path = "tmp/rspec_examples.txt"
1296
+ end
1297
+ ```
1298
+
1299
+ Then you can execute rspec with only failed tests after main knapsack_pro command finish.
1300
+
1301
+ ```
1302
+ # Run knapack_pro in Queue Mode and it will save failed tests in tmp/rspec_examples.txt
1303
+ bundle exec rake knapsack_pro:queue:rspec
1304
+
1305
+ # run only failed tests from tmp/rspec_examples.txt
1306
+ bundle exec rspec --only-failures
1307
+ ```
1308
+
1271
1309
  ### Questions around data usage and security
1272
1310
 
1273
1311
  #### What data is sent to your servers?
@@ -49,7 +49,8 @@ module KnapsackPro
49
49
  options = RSpec::Core::ConfigurationOptions.new(cli_args)
50
50
  exit_code = RSpec::Core::Runner.new(options).run($stderr, $stdout)
51
51
  exitstatus = exit_code if exit_code != 0
52
- RSpec.world.example_groups.clear
52
+
53
+ rspec_clear_examples
53
54
 
54
55
  KnapsackPro::Hooks::Queue.call_after_subset_queue
55
56
 
@@ -75,6 +76,23 @@ module KnapsackPro
75
76
  KnapsackPro::TestFilePresenter.stringify_paths(test_file_paths)
76
77
  )
77
78
  end
79
+
80
+ # Clear rspec examples without the shared examples:
81
+ # https://github.com/rspec/rspec-core/pull/2379
82
+ #
83
+ # Keep formatters and report to accumulate info about failed/pending tests
84
+ def self.rspec_clear_examples
85
+ if RSpec::ExampleGroups.respond_to?(:remove_all_constants)
86
+ RSpec::ExampleGroups.remove_all_constants
87
+ else
88
+ RSpec::ExampleGroups.constants.each do |constant|
89
+ RSpec::ExampleGroups.__send__(:remove_const, constant)
90
+ end
91
+ end
92
+ RSpec.world.example_groups.clear
93
+ RSpec.configuration.start_time = ::RSpec::Core::Time.now
94
+ RSpec.configuration.reset_filters
95
+ end
78
96
  end
79
97
  end
80
98
  end
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '0.41.0'
2
+ VERSION = '0.42.0'
3
3
  end
@@ -97,7 +97,7 @@ describe KnapsackPro::Runners::Queue::RSpecRunner do
97
97
  expect(RSpec::Core::Runner).to receive(:new).with(options).and_return(rspec_core_runner)
98
98
  expect(rspec_core_runner).to receive(:run).with($stderr, $stdout).and_return(exit_code)
99
99
 
100
- expect(RSpec).to receive_message_chain(:world, :example_groups, :clear)
100
+ expect(described_class).to receive(:rspec_clear_examples)
101
101
 
102
102
  expect(KnapsackPro::Hooks::Queue).to receive(:call_after_subset_queue)
103
103
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.41.0
4
+ version: 0.42.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-26 00:00:00.000000000 Z
11
+ date: 2017-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake