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

refactor: fix unit and documentation tests #4754

Merged
merged 6 commits into from
Jul 5, 2024

Conversation

SanchithHegde
Copy link
Member

@SanchithHegde SanchithHegde commented May 23, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

This PR enables the usage of sccache for caching compilation artifacts in the CI-pr workflow, and fixes the existing unit and documentation tests. I'll be taking up running the unit and documentation on pull requests in a separate PR, with some more CI workflow improvments.

Motivation and Context

Fixing unit tests so that they can be run as part of pull request checks.

How did you test it?

I've run unit tests locally with the following command (with locally running Postgres and Redis servers), and they pass:

FEATURES=$(cargo metadata --all-features --format-version 1 | \
  jq -r '
    [ ( .workspace_members | sort ) as $package_ids # Store workspace crate package IDs in `package_ids` array
    | .packages[] | select( IN(.id; $package_ids[]) ) | .features | keys[] ] | unique # Select all unique features from all workspace crates
    | del( .[] | select( any( . ; . == ("aws_kms", "aws_s3", "release", "vergen") ) ) ) # Exclude some features from features list
    | join(",") # Construct a comma-separated string of features for passing to `cargo`
  ')
cargo nextest run --config-file .github/nextest.toml --profile ci -E 'kind(lib)' --features "${FEATURES}" --status-level none

Screenshot of nextest run

Further, running documentation tests using the following command succeeds:

cargo test --doc --features "${FEATURES}"

I'm unable to include a screenshot of the documentation test run, since the output is too long.

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@SanchithHegde SanchithHegde added A-CI-CD Area: Continuous Integration/Deployment 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 May 23, 2024
@SanchithHegde SanchithHegde added this to the May 2024 Release milestone May 23, 2024
@SanchithHegde SanchithHegde self-assigned this May 23, 2024
@SanchithHegde SanchithHegde requested review from a team as code owners May 23, 2024 14:16
pixincreate
pixincreate previously approved these changes May 23, 2024
Copy link
Member

@pixincreate pixincreate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI changes, LGTM.

prajjwalkumar17
prajjwalkumar17 previously approved these changes Jul 4, 2024
@prajjwalkumar17
Copy link
Contributor

Approved on behalf of routing.

@SanchithHegde
Copy link
Member Author

I've rebased the PR on a recent main branch, updated the PR to only fix unit and documentation tests, and enabled the use of sccache in the CI-pr workflow. I'll be adding the unit and documentation tests in a separate PR, possibly as a separate job, once I figure out the arguments that we would pass to cargo nextest. I've updated the PR description to reflect the same.

@SanchithHegde SanchithHegde changed the title ci(CI-pr): use sccache for caching artifacts and run unit and documentation tests against PRs refactor: fix unit and documentation tests Jul 5, 2024
Copy link
Member

@pixincreate pixincreate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI stuff, LGTM!

@pixincreate pixincreate added this pull request to the merge queue Jul 5, 2024
Merged via the queue into main with commit 648cecb Jul 5, 2024
14 of 15 checks passed
@pixincreate pixincreate deleted the ci-pr-sccache-unit-doc-tests branch July 5, 2024 18:27
@pixincreate pixincreate removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jul 5, 2024
pixincreate added a commit that referenced this pull request Jul 8, 2024
…ify-cypress

* 'main' of github.com:juspay/hyperswitch:
  chore(version): 2024.07.08.0
  fix(connector): [adyen] remove browser info for mit and [paypal] add refund key in headers (#5225)
  chore(version): 2024.07.06.0
  feat(router): Pass the shipping email whenever the billing details are included in the session token response (#5228)
  fix(cypress): fix metadata missing while creating connector if not in auth (#5215)
  refactor: fix unit and documentation tests (#4754)
  feat(events): add hashed customer_email and feature_metadata (#5220)
  feat(events): Add payment metadata to hyperswitch-payment-intent-events (#5170)
  fix(analytics): using HashSet to represent the returned metrics (#5179)
  feat(core): billing_details inclusion in Payment Intent (#5090)
  feat(router): pass fields to indicate if the customer address details to be connector from wallets (#5210)
  fix(refunds): Add aliases on refund status for backwards compatibility (#5216)
  Feat(connector): [BRAINTREE] Implement Card Mandates (#5204)
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-feature Category: Feature request or enhancement C-test Category: Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants