Repository navigation
Add shared server test helpers, condense recent tests, and speed up slow BVT tests - #8367
Conversation
Moves recently added tests onto new shared helpers (JunitUtil, RequestTestUtil, QueryUpdateServiceTestUtil, SampleTypeTestHelper, AbstractContainerScopingTest) and folds near-duplicate tests into table-driven ones with the same coverage.
# Conflicts: # announcements/src/org/labkey/announcements/AnnouncementsController.java # experiment/src/org/labkey/experiment/api/SampleTypeServiceImpl.java
# Conflicts: # experiment/src/org/labkey/experiment/api/ExpMaterialTableImpl.java
… test runs with 25 rows
…sn't report them as leaks
|
Runtime of the server-side test classes this PR speeds up, in BVT-B postgres. Before is the median of 11 BVT-B runs from Nov 19 (develop and feature branches); after is this branch's run https://teamcity.labkey.org/buildConfiguration/LabkeyTrunk_BvtBPostgres/4274194
|
| /** Skips the test unless the labkey scope is PostgreSQL */ | ||
| public static void assumePostgres() | ||
| { | ||
| Assume.assumeTrue("Requires PostgreSQL", DbScope.getLabKeyScope().getSqlDialect().isPostgreSQL()); | ||
| } |
There was a problem hiding this comment.
Do we even need this anymore? Do we expect to add a new primary database type (or re-add SQL Server? 😱 )
There was a problem hiding this comment.
Nope, not needed. Removed.
# Conflicts: # query/src/org/labkey/query/suggestions/ColumnFactsCache.java
| */ | ||
| protected Container createProject(String name, Module... enabledModules) | ||
| { | ||
| String projectName = getClass().getName().replaceAll("[^A-Za-z0-9]", "_") + "-" + name; |
There was a problem hiding this comment.
Consider prefixing project names with _junit- to make it clear where these projects came from, in case the cleanup fails for some reason.
| String projectName = getClass().getName().replaceAll("[^A-Za-z0-9]", "_") + "-" + name; | |
| String projectName = "_junit-" + getClass().getName().replaceAll("[^A-Za-z0-9]", "_") + "-" + name; |
There was a problem hiding this comment.
Good idea. I ended up merging the PRs and doing this as a followup. #8390
) ## Rationale Give module tests a shared home for request cancellation checks and the samples query schema name, which two test classes had copied and several redeclared. ## Related Pull Requests - LabKey/platform#8367 - LabKey/limsModules#2618 - LabKey/labkey-workspaces#81 - LabKey/customModules#296 ## Changes - Add a helper for waiting on the notification WebSocket and reading request cancel metrics - Add a constant for the samples query schema name
#296) ## Rationale Speed up a slow BVT server-side test: the two TreatmentManager container scoping tests each created and deleted their own pair of study containers. ## Related Pull Requests - LabKey/platform#8367 - LabKey/limsModules#2618 - LabKey/testAutomation#3313 - LabKey/labkey-workspaces#81 ## Changes - Create the study containers once per test class and share them between the two container scoping tests
Rationale
Make server-side integration tests easier to write and faster to run. Many recently added tests hand-roll the same container, user, sample type, and update-service setup, hard-coded names that already had constants, and repeated near-identical test methods. Separately, the slowest server-side test classes in BVT-B spend most of their time in fixed sleeps, timeouts, and repeated container and study setup rather than in the code they verify.
Related Pull Requests
Changes
Tasks