knapsack_pro 2.11.0 → 2.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +22 -34
- data/lib/knapsack_pro/tracker.rb +1 -1
- data/lib/knapsack_pro/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9730c18427b9bf5c5f8c6ef527135ee374192ac527f7a934202fc7d5061577e
|
4
|
+
data.tar.gz: e3a7c4cd3b751cdb0110b2846c61dfdef37c0bcce6e05967b40a209fd69f4f7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a8ec2361a57993184c40fcfa8200e31ddfe70519bdbe266d96bbd8f9f9703fc41acbcfecf00f416aa0eefd3ee6e72b570f805411433a81f2c947c7853234f7b
|
7
|
+
data.tar.gz: 44b9a94233dc9a073a8a6d055b9d058c6b8e1e99407deab47cafdc444872db6c8f4c07e432a7bef4bcbaff07de4885ba2c833a983f957e40d8710f52a74cbd9d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 2.12.0
|
4
|
+
|
5
|
+
* Use 0 seconds as a default test file time execution instead of 0.1s because Knapsack Pro API already accepts 0 seconds value
|
6
|
+
|
7
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/140
|
8
|
+
|
9
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v2.11.0...v2.12.0
|
10
|
+
|
3
11
|
### 2.11.0
|
4
12
|
|
5
13
|
* Verify test runner adapter bind method is called to track test files time execution and ensure `tmp/knapsack_pro` directory is not removed accidentally
|
data/README.md
CHANGED
@@ -72,8 +72,9 @@ We keep this old FAQ in README to not break old links spread across the web. You
|
|
72
72
|
- [Set API key token](#set-api-key-token)
|
73
73
|
- [Set knapsack_pro command to execute tests](#set-knapsack_pro-command-to-execute-tests)
|
74
74
|
- [Repository adapter (How to set up 3 of 3)](#repository-adapter-how-to-set-up-3-of-3)
|
75
|
-
- [
|
76
|
-
- [When should you set global variable `KNAPSACK_PRO_REPOSITORY_ADAPTER=git` (
|
75
|
+
- [By default `KNAPSACK_PRO_REPOSITORY_ADAPTER` environment variable is undefined](#by-default-knapsack_pro_repository_adapter-environment-variable-is-undefined)
|
76
|
+
- [When should you set global variable `KNAPSACK_PRO_REPOSITORY_ADAPTER=git` (when CI provider is not supported and you use git)](#when-should-you-set-global-variable-knapsack_pro_repository_adaptergit-when-ci-provider-is-not-supported-and-you-use-git)
|
77
|
+
- [When you don't use git](#when-you-dont-use-git)
|
77
78
|
- [Queue Mode](#queue-mode)
|
78
79
|
- [How does queue mode work?](#how-does-queue-mode-work)
|
79
80
|
- [How to use queue mode?](#how-to-use-queue-mode)
|
@@ -84,7 +85,6 @@ We keep this old FAQ in README to not break old links spread across the web. You
|
|
84
85
|
- [Supported test runners in queue mode](#supported-test-runners-in-queue-mode)
|
85
86
|
- [Split test files by test cases](#split-test-files-by-test-cases)
|
86
87
|
- [RSpec split test files by test examples (by individual `it`s)](#rspec-split-test-files-by-test-examples-by-individual-its)
|
87
|
-
- [Why I see error: Don't know how to build task 'knapsack_pro:rspec_test_example_detector'?](#why-i-see-error-dont-know-how-to-build-task-knapsack_prorspec_test_example_detector)
|
88
88
|
- [How to manually define a list of slow test files to be split by test cases](#how-to-manually-define-a-list-of-slow-test-files-to-be-split-by-test-cases)
|
89
89
|
- [Extra configuration for CI server](#extra-configuration-for-ci-server)
|
90
90
|
- [Info about ENV variables](#info-about-env-variables)
|
@@ -442,7 +442,7 @@ __Tip 2:__ If you use one of unsupported CI providers ([here is list of supporte
|
|
442
442
|
|
443
443
|
### Repository adapter (How to set up 3 of 3)
|
444
444
|
|
445
|
-
####
|
445
|
+
#### By default `KNAPSACK_PRO_REPOSITORY_ADAPTER` environment variable is undefined
|
446
446
|
|
447
447
|
By default `KNAPSACK_PRO_REPOSITORY_ADAPTER` variable has no value so knapsack_pro will try to get info about branch name and commit hash from [supported CI](#supported-ci-providers) (CI providers have branch, commit, project directory stored as environment variables). In case when you use other CI provider like Jenkins then please set below variables on your own.
|
448
448
|
|
@@ -452,12 +452,20 @@ By default `KNAPSACK_PRO_REPOSITORY_ADAPTER` variable has no value so knapsack_p
|
|
452
452
|
|
453
453
|
You can also use git as repository adapter to determine branch and commit hash, please see below section.
|
454
454
|
|
455
|
-
#### When should you set global variable `KNAPSACK_PRO_REPOSITORY_ADAPTER=git` (
|
455
|
+
#### When should you set global variable `KNAPSACK_PRO_REPOSITORY_ADAPTER=git` (when CI provider is not supported and you use git)
|
456
456
|
|
457
457
|
`KNAPSACK_PRO_REPOSITORY_ADAPTER` - When it has the value `git`, your local version of git on CI server will be used to get the branch name and commit hash. You also need to set `KNAPSACK_PRO_PROJECT_DIR` with the project directory path.
|
458
458
|
|
459
459
|
`KNAPSACK_PRO_PROJECT_DIR` - Path to the project on the CI node, for instance `/home/ubuntu/my-app-repository`. It should be the top-level directory of your repository.
|
460
460
|
|
461
|
+
#### When you don't use git
|
462
|
+
|
463
|
+
If your CI provider does not expose commit hash and branch name through environment variables, then `knapsack_pro` gem does not know these values.
|
464
|
+
You can manually set the values of the current commit hash and branch name in the environment variables:
|
465
|
+
|
466
|
+
* `KNAPSACK_PRO_COMMIT_HASH` - commit hash.
|
467
|
+
* `KNAPSACK_PRO_BRANCH` - branch name.
|
468
|
+
|
461
469
|
## Queue Mode
|
462
470
|
|
463
471
|
knapsack_pro has a built-in queue mode designed to determine the optimal test suite split even when there is an unpredictably longer time execution of test files on one node (e.g. by
|
@@ -609,6 +617,8 @@ Knapsack Pro API provides recorded timing of test files from your previously rec
|
|
609
617
|
|
610
618
|
### RSpec split test files by test examples (by individual `it`s)
|
611
619
|
|
620
|
+
Read more about [this feature](https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it) and [common problems here](https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it#common-problems).
|
621
|
+
|
612
622
|
> ❗ __RSpec requirement:__ You need `RSpec >= 3.3.0` in order to use this feature.
|
613
623
|
|
614
624
|
In order to split RSpec slow test files by test examples across parallel CI nodes you need to set environment variable:
|
@@ -619,16 +629,6 @@ KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true
|
|
619
629
|
|
620
630
|
Thanks to that your CI build speed can be faster. We recommend using this feature with [Queue Mode](https://youtu.be/hUEB1XDKEFY) to ensure parallel CI nodes finish work at a similar time which gives you the shortest CI build time.
|
621
631
|
|
622
|
-
#### Why I see error: Don't know how to build task 'knapsack_pro:rspec_test_example_detector'?
|
623
|
-
|
624
|
-
If you will see error like:
|
625
|
-
|
626
|
-
```
|
627
|
-
Don't know how to build task 'knapsack_pro:rspec_test_example_detector' (See the list of available tasks with `rake --tasks`)
|
628
|
-
```
|
629
|
-
|
630
|
-
It probably means bundler can't find the rake task. You can try to remove the default prefix `bundle exec` used by knapsack_pro gem by setting `KNAPSACK_PRO_RSPEC_TEST_EXAMPLE_DETECTOR_PREFIX=""`.
|
631
|
-
|
632
632
|
### How to manually define a list of slow test files to be split by test cases
|
633
633
|
|
634
634
|
If you don't want to rely on a list of test files from Knapsack Pro API to determine slow test files that should be split by test cases then you can define your own list of slow test files.
|
@@ -857,6 +857,7 @@ Note: there are a few branch names that won't be encrypted because we use them a
|
|
857
857
|
* dev
|
858
858
|
* master
|
859
859
|
* staging
|
860
|
+
* [see full list of encryption excluded branch names](https://github.com/KnapsackPro/knapsack_pro-ruby/blob/master/lib/knapsack_pro/crypto/branch_encryptor.rb#L4)
|
860
861
|
|
861
862
|
#### How to debug branch names?
|
862
863
|
|
@@ -1600,12 +1601,12 @@ jobs:
|
|
1600
1601
|
strategy:
|
1601
1602
|
fail-fast: false
|
1602
1603
|
matrix:
|
1603
|
-
#
|
1604
|
-
# Use higher number if you have slow tests to split them
|
1605
|
-
# Remember to update ci_node_index below to 0..
|
1604
|
+
# [n] - where the n is a number of parallel jobs you want to run your tests on.
|
1605
|
+
# Use a higher number if you have slow tests to split them between more parallel jobs.
|
1606
|
+
# Remember to update the value of the `ci_node_index` below to (0..n-1).
|
1606
1607
|
ci_node_total: [2]
|
1607
|
-
#
|
1608
|
-
#
|
1608
|
+
# Indexes for parallel jobs (starting from zero).
|
1609
|
+
# E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc.
|
1609
1610
|
ci_node_index: [0, 1]
|
1610
1611
|
|
1611
1612
|
steps:
|
@@ -2064,20 +2065,7 @@ If you go to [user dashboard](https://knapsackpro.com/dashboard) and open `Build
|
|
2064
2065
|
|
2065
2066
|
##### Why all test files have 0.1s time execution for my CI build in user dashboard?
|
2066
2067
|
|
2067
|
-
|
2068
|
-
|
2069
|
-
* you should not clean up `tmp` directory in your tests (for instance in RSpec hooks like `before` or `after`) so knapsack_pro can publish measured time execution data to Knapsack Pro API server. knapsack_pro Queue Mode saves temporary files with collected time execution data in `your_rails_project/tmp/knapsack_pro/queue/`.
|
2070
|
-
* please ensure you have in your `rails_helper.rb` or `spec_helper.rb` line that allows to measure tests:
|
2071
|
-
|
2072
|
-
```ruby
|
2073
|
-
require 'knapsack_pro'
|
2074
|
-
|
2075
|
-
# CUSTOM_CONFIG_GOES_HERE
|
2076
|
-
|
2077
|
-
KnapsackPro::Adapters::RSpecAdapter.bind
|
2078
|
-
```
|
2079
|
-
|
2080
|
-
The 0.1s is a default time execution used when test file is an empty file or its content are all pending tests.
|
2068
|
+
https://knapsackpro.com/faq/question/why-all-test-files-have-01s-time-execution-for-my-ci-build-in-user-dashboard
|
2081
2069
|
|
2082
2070
|
##### Why when I use Queue Mode for RSpec and test fails then I see multiple times info about failed test in RSpec result?
|
2083
2071
|
|
data/lib/knapsack_pro/tracker.rb
CHANGED
@@ -4,7 +4,7 @@ module KnapsackPro
|
|
4
4
|
|
5
5
|
# when test file is pending, empty with no tests or has syntax error then assume time execution
|
6
6
|
# to better allocate it in Queue Mode for future CI build runs
|
7
|
-
DEFAULT_TEST_FILE_TIME = 0.
|
7
|
+
DEFAULT_TEST_FILE_TIME = 0.0 # seconds
|
8
8
|
|
9
9
|
attr_reader :global_time_since_beginning, :global_time, :test_files_with_time
|
10
10
|
attr_writer :current_test_path
|
data/lib/knapsack_pro/version.rb
CHANGED
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: 2.
|
4
|
+
version: 2.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|