-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
ensure workspace webhook configs can be persisted correctly #18034
ensure workspace webhook configs can be persisted correctly #18034
Conversation
…and persistence layers
airbyte-server/src/main/java/io/airbyte/server/handlers/WorkspacesHandler.java
Show resolved
Hide resolved
airbyte-server/src/main/java/io/airbyte/server/handlers/WorkspacesHandler.java
Show resolved
Hide resolved
@@ -108,7 +105,7 @@ public WorkspaceRead createWorkspace(final WorkspaceCreate workspaceCreate) | |||
.withTombstone(false) | |||
.withNotifications(NotificationConverter.toConfigList(workspaceCreate.getNotifications())) | |||
.withDefaultGeography(defaultGeography) | |||
.withWebhookOperationConfigs(WorkspaceWebhookConfigsConverter.toPersistenceWrite(workspaceCreate.getWebhookConfigs())); | |||
.withWebhookOperationConfigs(WorkspaceWebhookConfigsConverter.toPersistenceWrite(workspaceCreate.getWebhookConfigs(), uuidSupplier)); |
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.
one thought: can we rename the uuidSupplier
variable to reflect this is specifically to provide a uuid for the webhook config objects? Not necessarily related to this change, however will help readability.
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.
This is not related to your change, can you add the @VisibleForTesting annotation on the construction at Line 66 so it's obvious this is for testing? Thanks!
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.
one thought: can we rename the
uuidSupplier
variable to reflect this is specifically to provide a uuid for the webhook config objects?
We do actually use it for other things -- e.g. generating new workspace ids -- so I think leaving it makes sense? (Though I'm still confused as to why we're doing that.)
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.
Oh interesting. Leaving it is good then!
airbyte-server/src/main/java/io/airbyte/server/converters/WorkspaceWebhookConfigsConverter.java
Outdated
Show resolved
Hide resolved
airbyte-server/src/main/java/io/airbyte/server/converters/WorkspaceWebhookConfigsConverter.java
Show resolved
Hide resolved
airbyte-server/src/main/java/io/airbyte/server/converters/WorkspaceWebhookConfigsConverter.java
Outdated
Show resolved
Hide resolved
airbyte-server/src/test/java/io/airbyte/server/handlers/WorkspacesHandlerTest.java
Outdated
Show resolved
Hide resolved
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.
Nicely done.
I have some suggestions for readability & making it easier to understand how we are returning the WebhookOperations object in the API.
Although the logic looks sound to me, I want to be careful on the testing side. My understanding of the tests we have on this today:
- test workspace writes go through the secret writer to ensure secrets are converted into coordinates.
- test the secret writer correctly converts auth tokens
- test the update route returns correct webhooks for patch and full updates.
- do we test create/read routes?
Want to be clear on ^ before we merge.
@davinchia thanks for the review! That's a good summary of the testing situation - I added coverage on the create and read routes in the latest revision as well. Let me know if there are any other questions/comments! |
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 good!
…q#18034) * ensure workspace webhook configs can be correctly passed between API and persistence layers * remove unnecessary logging * add unit tests to workspace webhook config handling * additional testing and style cleanup around workspace webhook config handling
What
Makes sure that the workspace-level webhook operation configs are passed correctly between API and persistence.
How
workspace/update
route.Recommended reading order
airbyte-api/src/main/openapi/config.yaml
airbyte-server/src/main/java/io/airbyte/server/handlers/WorkspacesHandler.java
airbyte-server/src/main/java/io/airbyte/server/converters/WorkspaceWebhookConfigsConverter.java
Testing
Validated e2e that webhook configs can be written, updated, and read. Added some unit test coverage.