-
Notifications
You must be signed in to change notification settings - Fork 102
fix(backend): fix OP resource tests #2969
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
fix(backend): fix OP resource tests #2969
Conversation
365734f to
a48dfb4
Compare
02caf52 to
821c733
Compare
821c733 to
8c5667a
Compare
| } | ||
| ) | ||
|
|
||
| container.singleton( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, probably due to rebasing, this got duplicated a few times.
| table.uuid('tenantId').notNullable() | ||
| table.foreign('tenantId').references('id').inTable('tenants') | ||
| }) | ||
| .table('grants', function (table) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grant's don't need tenantId - they're never queried on the backend by that filter, and the tenant it is for can be determined by the auth server URL path. Having the requirement explicitly in this table introduces some backwards compatibility issues.
| [EndpointType.WebhookBaseUrl]: TenantEndpointType.WebhookBaseUrl | ||
| } | ||
|
|
||
| export const getTenantEndpoints: TenantResolvers<ApolloContext>['endpoints'] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolver not being used anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like it leaves the service getTenantEndpointsPage method unused... remove?
| receiver: String! | ||
| "Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence)" | ||
| idempotencyKey: String | ||
| "ID of the tenant" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tenantId got removed from the quote resolver input for backwards compatibility issues and it can be retrieved from the wallet address anyways
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it can be retrieved from the wallet address anyways
I think perhaps this is the better pattern. It's simpler and I don't think we need to verify against the requestor's expectation for what the tenantId should be (ie, the tenantId being removed here).
I remember you mentioning that before and not having much of an opinion but I came across it myself when dealing with checking access for the createQuote resolver and felt like passing it in wasn't really providing any value, and it does make the gql input less complicated. Since before it was required for everyone but really only needed when an operator is making it on behalf of a tenant.
| mockAccessToken, | ||
| mockPendingGrant | ||
| } from '@interledger/open-payments' | ||
| import { v4 as uuid } from 'uuid' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The modifications here are all removing the tenantId parameter from grant creation calls
52767da to
3e84958
Compare
Changes proposed in this pull request
operatorApiSecretwhose inclusion the headers will allow seeding to take place during localenv startupbackendContext
Fixes #2968.
This is part of a greater effort to bring the multi-tenant feature branch back up to par with the standards of the main branch, as a lot of tests and github actions are failing due to changes to the database that add foreign key constraints to many of the tables.
This PR fixes the tests for the Open Payments resources, as well as sets up some fixes for the test environment that gets set up by many of the tests.
Overall story is captured here: #2972
Checklist
fixes #numberuser-docslabel (if necessary)