Skip to content

Comments

Mock combinators#3014

Merged
pcapriotti merged 7 commits intodevelopfrom
pcapriotti/mock-utilities
Jan 25, 2023
Merged

Mock combinators#3014
pcapriotti merged 7 commits intodevelopfrom
pcapriotti/mock-utilities

Conversation

@pcapriotti
Copy link
Contributor

This PR introduces a very simple system for specifying federation mocks in a composable way. This replaces previous attempts (in Galley) that were only adopted in a few tests. All instances of mocked federator are now using the new system.

The system itself is a super-minimalistic "web framework" of sorts, based on a ReaderT FederatedRequest MaybeT monad transformer. You use guard to expect a certain request, and the Alternative combinators to specify multiple responses based on various criteria.

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@pcapriotti pcapriotti temporarily deployed to cachix January 24, 2023 14:56 — with GitHub Actions Inactive
@pcapriotti pcapriotti temporarily deployed to cachix January 24, 2023 14:56 — with GitHub Actions Inactive
@pcapriotti pcapriotti marked this pull request as ready for review January 24, 2023 14:56
@pcapriotti pcapriotti temporarily deployed to cachix January 24, 2023 14:56 — with GitHub Actions Inactive
@pcapriotti pcapriotti temporarily deployed to cachix January 24, 2023 14:56 — with GitHub Actions Inactive
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Jan 24, 2023
@mdimjasevic mdimjasevic self-requested a review January 24, 2023 15:00
@pcapriotti pcapriotti temporarily deployed to cachix January 24, 2023 15:58 — with GitHub Actions Inactive
@pcapriotti pcapriotti temporarily deployed to cachix January 24, 2023 15:58 — with GitHub Actions Inactive
@smatting smatting self-requested a review January 25, 2023 08:20
@pcapriotti pcapriotti temporarily deployed to cachix January 25, 2023 09:08 — with GitHub Actions Inactive
@pcapriotti pcapriotti temporarily deployed to cachix January 25, 2023 09:08 — with GitHub Actions Inactive
@pcapriotti pcapriotti temporarily deployed to cachix January 25, 2023 09:11 — with GitHub Actions Inactive
@pcapriotti pcapriotti temporarily deployed to cachix January 25, 2023 09:11 — with GitHub Actions Inactive
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that withTempMockFederator is gone, how about renaming the remaining withTempMockFederator' to withTempMockFederator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not gone, it's the low-level function that is used by withTempMockFederator'. We could consider condensing all of these into a single function that takes a Mock parameter, but I would leave it for another PR.

@pcapriotti pcapriotti temporarily deployed to cachix January 25, 2023 10:02 — with GitHub Actions Inactive
@pcapriotti pcapriotti temporarily deployed to cachix January 25, 2023 10:02 — with GitHub Actions Inactive
pcapriotti and others added 5 commits January 25, 2023 11:02
Co-authored-by: Igor Ranieri Elland <54423+elland@users.noreply.github.com>
@pcapriotti pcapriotti force-pushed the pcapriotti/mock-utilities branch from 8ca5fd6 to 0739f2b Compare January 25, 2023 10:03
@pcapriotti pcapriotti temporarily deployed to cachix January 25, 2023 10:03 — with GitHub Actions Inactive
@pcapriotti pcapriotti temporarily deployed to cachix January 25, 2023 10:03 — with GitHub Actions Inactive
@pcapriotti pcapriotti force-pushed the pcapriotti/mock-utilities branch from 0739f2b to ccfc113 Compare January 25, 2023 10:04
@pcapriotti pcapriotti temporarily deployed to cachix January 25, 2023 10:04 — with GitHub Actions Inactive
@pcapriotti pcapriotti temporarily deployed to cachix January 25, 2023 10:04 — with GitHub Actions Inactive
@pcapriotti pcapriotti force-pushed the pcapriotti/mock-utilities branch from ccfc113 to beead90 Compare January 25, 2023 13:04
@pcapriotti pcapriotti temporarily deployed to cachix January 25, 2023 13:04 — with GitHub Actions Inactive
@pcapriotti pcapriotti temporarily deployed to cachix January 25, 2023 13:04 — with GitHub Actions Inactive
@pcapriotti pcapriotti merged commit f6b2f93 into develop Jan 25, 2023
@pcapriotti pcapriotti deleted the pcapriotti/mock-utilities branch January 25, 2023 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants