Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(test_utils): Add custom-headers and custom delay support to rustman #2636

Merged
merged 19 commits into from
Nov 7, 2023

Conversation

pixincreate
Copy link
Member

@pixincreate pixincreate commented Oct 18, 2023

Type of Change

  • New feature
  • Documentation
  • CI/CD

Description

Closes #2646
This PR as usual, narrows the main aim of rustman by making specific to Hyperswitch. With this, you should now be able to:

  • Set delay between each request sent as per your own wish while default being 7 milliseconds
  • Pass in custom-headers of your wish in run time

How custom-headers works

Custom headers inject the headers that you pass in command line into the event.prerequest.js file and sets a flag to true. After the collection is run, it checks the flag and depending on that, it will git checkout HEAD -- <collection_name>/event.prerequest.js to restore the file to same as before.
We can also pass -e environment.json where you pass in custom headers but that requires some significant changes to be done to the collections to support that.

Motivation and Context

This will allow us to pass different headers in run-time to test new things and also allow you to set delay of your wish. You can now set the delay to 100000000000 and wait for ages to run a single test :D

How did you test it?

Command used: (Custom headers taken from #2116)
Delay set to 0.5 seconds

cargo run --bin test_utils -- --base_url=http://127.0.0.1:8080 --admin_api_key=test_admin --connector_name=stripe --folder "QuickStart" --header "payment_confirm_source:merchant_server" --header "another_header_key:and_its_value" --delay_request 4294967295

In run-time, we can see the custom-headers being injected here:
image

image
Value being stored in DB:
image

Ran Stripe Collection:
image

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code

@pixincreate pixincreate added A-CI-CD Area: Continuous Integration/Deployment C-doc Category: Documentation updates C-feature Category: Feature request or enhancement S-waiting-on-review Status: This PR has been implemented and needs to be reviewed C-test Category: Tests labels Oct 18, 2023
@pixincreate pixincreate added this to the October 2023 Milestone milestone Oct 18, 2023
@pixincreate pixincreate requested a review from a team as a code owner October 18, 2023 17:58
@pixincreate pixincreate self-assigned this Oct 18, 2023
@pixincreate pixincreate requested a review from a team as a code owner October 18, 2023 18:02
crates/test_utils/src/newman_runner.rs Outdated Show resolved Hide resolved
crates/test_utils/src/newman_runner.rs Outdated Show resolved Hide resolved
crates/test_utils/src/newman_runner.rs Outdated Show resolved Hide resolved
crates/test_utils/src/newman_runner.rs Outdated Show resolved Hide resolved
crates/test_utils/src/newman_runner.rs Outdated Show resolved Hide resolved
crates/test_utils/src/main.rs Outdated Show resolved Hide resolved
@pixincreate pixincreate requested a review from a team as a code owner November 1, 2023 18:51
crates/test_utils/README.md Outdated Show resolved Hide resolved
crates/test_utils/src/newman_runner.rs Outdated Show resolved Hide resolved
crates/test_utils/src/newman_runner.rs Outdated Show resolved Hide resolved
crates/test_utils/src/newman_runner.rs Outdated Show resolved Hide resolved
crates/test_utils/src/newman_runner.rs Outdated Show resolved Hide resolved
crates/test_utils/src/main.rs Outdated Show resolved Hide resolved
SanchithHegde
SanchithHegde previously approved these changes Nov 5, 2023
@pixincreate pixincreate enabled auto-merge November 7, 2023 11:34
@pixincreate pixincreate added this pull request to the merge queue Nov 7, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 7, 2023
@pixincreate pixincreate added this pull request to the merge queue Nov 7, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 7, 2023
@SanchithHegde SanchithHegde added this pull request to the merge queue Nov 7, 2023
Merged via the queue into main with commit 1effddd Nov 7, 2023
10 of 12 checks passed
@SanchithHegde SanchithHegde deleted the custom-headers branch November 7, 2023 17:43
@pixincreate pixincreate removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CI-CD Area: Continuous Integration/Deployment C-doc Category: Documentation updates C-feature Category: Feature request or enhancement C-test Category: Tests
Projects
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

[FEATURE] Add custom-headers support for Rustman
5 participants