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

Add test helpers to create and delete API keys #2193

Merged
merged 6 commits into from
Dec 17, 2024

Conversation

labkey-tchad
Copy link
Member

@labkey-tchad labkey-tchad commented Dec 13, 2024

Rationale

Some tests need to have multiple remote API sessions open against servers that don't have database authentication enabled. In these cases tests should be able to log in via CAS then generate an API key that can create independent API connections.
We should also be able to delete the api keys to reduce clutter on remote servers.

With the large data involved in these tests, project deletion can exceed the load balancer/firewall timeout:

java.lang.RuntimeException: Failed to delete container: SampleStressImport
  at org.labkey.test.util.APIContainerHelper.deleteContainer(APIContainerHelper.java:169)
  at org.labkey.test.util.APIContainerHelper.doDeleteProject(APIContainerHelper.java:130)
  at org.labkey.test.util.AbstractContainerHelper.deleteProject(AbstractContainerHelper.java:151)
  at org.labkey.test.util.AbstractContainerHelper.deleteProject(AbstractContainerHelper.java:145)
  at org.labkey.test.tests.samplemanagement.perfandstress.DashboardReadsWithImportStressTest.doCleanup(DashboardReadsWithImportStressTest.java:38)
  [...]
Caused by: org.labkey.remoteapi.CommandException: Gateway Time-out
  at app//org.labkey.remoteapi.Command.throwError(Command.java:412)
  at app//org.labkey.remoteapi.Command.checkThrowError(Command.java:366)
  at app//org.labkey.remoteapi.Command.executeRequest(Command.java:352)
  at app//org.labkey.remoteapi.Command._execute(Command.java:321)
  at app//org.labkey.remoteapi.Command.execute(Command.java:185)
  at app//org.labkey.test.util.APIContainerHelper.deleteContainer(APIContainerHelper.java:156)

APIContainerHelper.deleteContainer should catch the 504 response from these cases and wait for the container to be gone.

Related Pull Requests

Changes

  • Add test helpers to create and delete API keys
  • Allow APIContainerHelper.deleteContainer to handle 504 response

@labkey-tchad labkey-tchad requested review from a team and labkey-chrisj and removed request for a team December 13, 2024 20:54
}
else
{
TestLogger.log("Unexpected number of rows found: " + rows.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be an error condition?

@labkey-tchad labkey-tchad merged commit 7f9f30d into release24.11-SNAPSHOT Dec 17, 2024
2 checks passed
@labkey-tchad labkey-tchad deleted the 24.11_fb_cloudStressDeployment branch December 17, 2024 19:55
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.

2 participants