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

[WOR-1772] Catch duplicate PAO exception when trying to create a PAO that has been deleted #1772

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

marctalbott
Copy link
Member

@marctalbott marctalbott commented Jul 11, 2024

WOR-1772

  • If WSM tries to get a PAO and gets a 404, but gets a duplicate exception when it tries to create a new one, then the PAO exists in TPS, but it has been deleted. A workspace's PAO will only be deleted if the workspace itself is in the process of being deleted. To prevent WSM from throwing exceptions if a user tries to get a workspace between when the PAO is deleted and the rest of the workspace is deleted, WSM will catch the duplicate exception thrown when re-creating and return null.

@marctalbott marctalbott requested a review from a team as a code owner July 11, 2024 21:03
@marctalbott marctalbott requested review from cahrens and aherbst-broad and removed request for a team July 11, 2024 21:03
@@ -113,7 +113,16 @@ public TpsPaoGetResult getOrCreatePao(
return pao.get();
}
// Workspace doesn't have a PAO, so create an empty one for it.
createPao(objectId, null, component, objectType);
try {
Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to get a test around this where we have some other policy tests and wasn't able to get the mocking to cooperate. I can try some other things, but felt like this was a bit of a rare situation and wasn't worth the extra effort. Let me know if you disagree and I'll see what else we can do to get coverage here.

Copy link
Member

@cahrens cahrens left a comment

Choose a reason for hiding this comment

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

Thanks, @marctalbott ! A test would be nice, but I agree that it may not necessarily be worth the effort.

Copy link

sonarcloud bot commented Jul 11, 2024

@marctalbott marctalbott merged commit f54e983 into main Jul 12, 2024
20 checks passed
@marctalbott marctalbott deleted the mtalbott-handle-deleted-paos-getOrCreate branch July 12, 2024 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants