Skip to content

Commit

Permalink
[SEO 12.] Avoid 30x redirect in internal links (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturT authored Jan 2, 2025
1 parent fd00dd9 commit fe0900d
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ In environment variables, we set Knapsack Pro API key `KNAPSACK_PRO_TEST_SUITE_T
When everything is filled you can save your pipeline and run your buildkite agents across your CI nodes.
Push a new commit to your repository and allow it to pass. The first CI build run will record time execution of your tests and saves it to Knapsack Pro API.

Go to user [dashboard](https://knapsackpro.com/dashboard) and click build metrics link next to your API token. Click show link on the recent build and ensure the time execution data were recorded for all your CI nodes. You should see info that build subsets were collected.
Go to user [dashboard](https://knapsackpro.com/sessions) and click build metrics link next to your API token. Click show link on the recent build and ensure the time execution data were recorded for all your CI nodes. You should see info that build subsets were collected.

From now on you can run your tests with optimal test suite split thanks to dynamic tests allocation across CI nodes. The second commit pushed to repo should have better auto balancing time because Knapsack Pro API can use time execution recorded in the previous run to prepare better work queue.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ You may find useful to export data about your CI builds and timing for your test

## How to get a list of all CI builds

You can get the list of all CI builds recorded by Knapsack Pro tool. You need `test suite API token`. You can get it from [user dashboard](https://knapsackpro.com/dashboard).
You can get the list of all CI builds recorded by Knapsack Pro tool. You need `test suite API token`. You can get it from [user dashboard](https://knapsackpro.com/sessions).

{% highlight plain %}
curl -X GET \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Learn [what Regular Mode and Queue Mode are](/2020/how-to-speed-up-ruby-and-java

Please see below the dictionary of terms we will use in this article:

- **Knapsack Pro API** - it's an API responsible for deciding how to split test files between parallel CI nodes. Your API client is going to send recorded time execution of your test files to the API to see results in the [Knapsack Pro user dashboard](https://knapsackpro.com/dashboard?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=how-to-build-knapsack-pro-api-client-from-scratch-in-any-programming-language). Knapsack Pro API will use the data to better predict how to split your test files in future CI build runs. Here is the [documentation for all API endpoints](/api/).
- **Knapsack Pro API** - it's an API responsible for deciding how to split test files between parallel CI nodes. Your API client is going to send recorded time execution of your test files to the API to see results in the [Knapsack Pro user dashboard](https://knapsackpro.com/sessions?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=how-to-build-knapsack-pro-api-client-from-scratch-in-any-programming-language). Knapsack Pro API will use the data to better predict how to split your test files in future CI build runs. Here is the [documentation for all API endpoints](/api/).

- **Knapsack Pro client** - is a library that you install in your project. It contains business logic responsible for connecting with Knapsack Pro API. The client knows how to read environment variables for various CI providers to automatically detect git commit hash, branch name, number of total parallel CI nodes, and CI node index. Knapsack Pro client connects with the Knapsack Pro API to fetch a list of test files to run a proper set of tests on a given parallel CI node. Knapsack Pro client also knows how to integrate with a test runner in a given programming language. For instance, the Knapsack Pro client in Ruby programming language is a `knapsack_pro` ruby gem. It knows how to run tests for test runners like RSpec, Cucumber, Minitest, etc. Simply speaking, Knapsack Pro client is a wrapper around test runner (testing framework) in a given programing language. Here is a [list of existing Knapsack Pro clients](/).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The combination of your specific CI pipeline configuration and your RSpec usage

What we know from experience is that usually the Queue Mode uncovers different adjustment needs than the Regular Mode. The reason behind that is that in the Queue Mode, each one of your parallel CI nodes will usually run the RSpec command multiple times (as compared to just one run per node in the Regular Mode). This distinction might result in additional challenges to solve.

As with all debugging, it's best to narrow down (isolate) possible issues we are tackling at a given time. This is why we strongly suggest to [set up](https://docs.knapsackpro.com/) the Regular Mode first. When you ensure it works as expected, and confirm that in your [User Dashboard](https://knapsackpro.com/dashboard?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=setting-up-knapsack-pro-in-rspec-project), you are ready to proceed to the Queue Mode setup.
As with all debugging, it's best to narrow down (isolate) possible issues we are tackling at a given time. This is why we strongly suggest to [set up](https://docs.knapsackpro.com/) the Regular Mode first. When you ensure it works as expected, and confirm that in your [User Dashboard](https://knapsackpro.com/sessions?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=setting-up-knapsack-pro-in-rspec-project), you are ready to proceed to the Queue Mode setup.

And now for the good news: we have documented all of the common issues you might encounter during your setup in our [FAQ](https://knapsackpro.com/faq?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=setting-up-knapsack-pro-in-rspec-project). Keep that in mind during your onboarding.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Apart from these two, there are two additional variables defined: `KNAPSACK_PRO_

`KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST` is a token needed for Knapsack API authorization. It's pulled from GitHub secrets set in your project's repository. You can access your secrets in the Settings -> Secrets on your repo's GH page.

To view or generate Knapsack API token for your project, head over to [Knapsack User's Dashboard](https://knapsackpro.com/dashboard/?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=run-jest-on-github-actions-with-parallelization) (you may need to sign up for an account if you don't have one). Save your API token in your GitHub Secrets as `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST`.
To view or generate Knapsack API token for your project, head over to [Knapsack User's Dashboard](https://knapsackpro.com/sessions?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=run-jest-on-github-actions-with-parallelization) (you may need to sign up for an account if you don't have one). Save your API token in your GitHub Secrets as `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST`.

The other variable, `KNAPSACK_PRO_FIXED_QUEUE_SPLIT` needs to be set to `true`. This will ensure the retry functionality on GitHub Actions works correctly with Knapsack API.

Expand Down Expand Up @@ -121,6 +121,6 @@ jobs:

When your GitHub Actions is properly set up, it's going to run your build when you push new changes to the repository. You can now enjoy the optimal parallelization of your Jest tests.

To see how Knapsack is splitting your test suite, visit the [User Dashboard](https://knapsackpro.com/dashboard/?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=run-jest-on-github-actions-with-parallelization). The GitHub Actions builds will also be visible under the _Actions_ tab in your project's repository on GH.
To see how Knapsack is splitting your test suite, visit the [User Dashboard](https://knapsackpro.com/sessions?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=run-jest-on-github-actions-with-parallelization). The GitHub Actions builds will also be visible under the _Actions_ tab in your project's repository on GH.

Anything unclear? Leave a comment below or go ahead and [contact us](https://knapsackpro.com/contact?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=run-jest-on-github-actions-with-parallelization) about your problem. We'll be happy to help!
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This allows running the whole RSpec test suite in just 5 minutes 20 seconds!

<img src="/images/blog/posts/auto-scaling-buildkite-ci-build-agents-for-rspec-run-parallel-jobs-in-minutes-instead-of-hours/151-parallel-nodes.png" alt="parallel machines, parallel jobs, Buildkite, Knapsack Pro, tests, RSpec" />

The above graph comes from the Knapsack Pro [user dashboard](https://knapsackpro.com/dashboard?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=auto-scaling-buildkite-ci-build-agents-for-rspec-run-parallel-jobs-in-minutes-instead-of-hours). 151 parallel jobs are a lot of machines. It would take the whole screen to show you 151 bars. You can only see the last few bars on the graph. The bars are showing how the RSpec test files were split between parallel machines.
The above graph comes from the Knapsack Pro [user dashboard](https://knapsackpro.com/sessions?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=auto-scaling-buildkite-ci-build-agents-for-rspec-run-parallel-jobs-in-minutes-instead-of-hours). 151 parallel jobs are a lot of machines. It would take the whole screen to show you 151 bars. You can only see the last few bars on the graph. The bars are showing how the RSpec test files were split between parallel machines.

You can see that each parallel machine finishes work at a similar time. The right edges of all of the bars are pretty close to each other. This is the important part. You want to ensure the RSpec work is distributed evenly between parallel jobs. This way you can avoid a bottleneck - a slow job running too many test files. I'll show you how to do it.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Cypress is an amazing tool for end to end testing Rails applications, but large

## Set up Knapsack Pro API Keys

First step is to go to your Knapsack [dashboard](https://knapsackpro.com/dashboard?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=faster-cypress-rspec-test-suite-for-rails-apps-on-github-actions-using-knapsack-pro) and grab your API keys for both RSpec and Cypress. Once you have those, go to your Github Repo's settings, for example:
First step is to go to your Knapsack [dashboard](https://knapsackpro.com/sessions?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=faster-cypress-rspec-test-suite-for-rails-apps-on-github-actions-using-knapsack-pro) and grab your API keys for both RSpec and Cypress. Once you have those, go to your Github Repo's settings, for example:

<img width="1404" alt="image" src="https://user-images.githubusercontent.com/64985/111044967-80297880-8400-11eb-92b6-8a1e8aa2701e.png">

Expand Down Expand Up @@ -233,7 +233,7 @@ Once you've completed the above steps, trigger a test run on your repo. You shou

<img width="345" alt="Screen Shot 2021-03-23 at 10 13 30 AM" src="https://user-images.githubusercontent.com/64985/112190195-017fc880-8bc2-11eb-85ea-00fa3469be43.png">

Now check your [Knapsack Dashboard](https://knapsackpro.com/dashboard?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=faster-cypress-rspec-test-suite-for-rails-apps-on-github-actions-using-knapsack-pro) for the results 🚀
Now check your [Knapsack Dashboard](https://knapsackpro.com/sessions?utm_source=docs_knapsackpro&utm_medium=blog_post&utm_campaign=faster-cypress-rspec-test-suite-for-rails-apps-on-github-actions-using-knapsack-pro) for the results 🚀

The complete example Rails app can be found [here](https://github.com/goodproblems/knapsack-example-rails-app). Happy testing!

Expand Down
Loading

0 comments on commit fe0900d

Please sign in to comment.