Repository navigation
Remove repeated tests from files skipped by the first pass - #357
Merged
Merged
Conversation
The bundled Datadog spec is big, and parsing it takes most of a second. Five tests parsed it again with the same configuration, so they now share one parsed spec, which saves about 4 seconds of the test run.
Four tests checked the same validation, which rejects combining authentication.api-keys with any of the single API key properties. They differed only in the property name and value, so one test with a line per property shows the whole rule at once.
testNotFoundWithPathParametersIsEmpty reads the same table of the same spec, with the same path parameter, and checks the same request URI and empty result, so testLeadingPathParameter covered nothing more.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the second pass of #355. That pass skipped the test files that open PRs were changing. Those PRs are merged now, so this pass reviews those files:
TestOpenApiSpec,TestOpenApiConfig,TestOpenApiClientRequests,TestOpenApiClient,TestOpenApiServers,TestSpecLocation,TestCachingHttpClient,TestAuthenticatingHttpClient, andTestKeycloakAuthentication. It also reviews test files added since then, likeTestUserCredentialsandTestOpenApiSchemaFromTags. A repeated test is more code to keep in sync, and it covers nothing new. Repeated loads of a big spec make the suite slower for no gain.Changes
TestOpenApiSpec: the fivegetDatadog*tests share one parsed specspecs/datadog.yamlwith the same config. The five tests took 4.6 s before and 1.6 s after. The trimmed-prefix test still parses its own spec, because it uses a different configTestOpenApiConfig.testApiKeysCombinedWith*: four tests become oneisApiKeysValid()directlyTestOpenApiClientRequests.testLeadingPathParametertestNotFoundWithPathParametersIsEmptyreads the same table of the same spec, with the same path parameter, and checks the same request URI and empty resultCoverage of src/main (JaCoCo,
mvnd clean verify -Dair.check.skip-jacoco=false)I compared the covered lines and branches one by one. No line or branch lost coverage. The one gained line is
ProbeLimit.toString()with a set limit (line 52). As #355 found, that line runs only as the session property encoder, so its coverage depends on timing.Tests: 485 before, 481 after.
Not touched
Open PR #356 changes
authentication/TestAuthentication.java, so I left it alone.Possibly redundant, but kept
TestCachingHttpClient.testRequestCanForceRevalidation:testCacheDirectivesDontSelectStoredResponsesends the same first two requests and makes the same final assertions. But it checks only the state after a thirdPragmarequest, so it can't tell which request revalidated.TestCachingHttpClient.testCookieParametersSelectStoredResponse:HttpCacheputs every header in the key, so this runs the same code astestHeaderParametersSelectStoredResponse. It still protects againstCookiebeing left out of the key later.TestAuthenticatingHttpClient.testRejectedTokenOfClientSecretBasicIsRefreshed: its assertions are a subset oftestRejectedTokenIsRefreshed. But it is the only fast test of a refresh with client_secret_basic. The Keycloak test needs a container.TestCachingHttpClient.testVary: every header is already in the cache key, so its assertions would still pass if Vary matching broke. A stronger test would be better than removing it.TestOpenApiSpec.testResultsPathToArrayOrObjectandtestResultsPathToUnion: their first assertions repeattestPaginatedResultsNullabilityandtestUnionOfObjectAndArrayResponses. Their other assertions are unique.TestOpenApiSpec.testTablesWithoutColumns: its/namespart repeatstestPlainValueResponses. The/countpart is unique.TestOpenApiSpec.getGithubPaginatedTablesandgetGithubPatchedOperationsoverlap, but each checks things the other doesn't.TestOpenApiConfig.testTrimmedPathPrefixes: its first assertion repeatstestExplicitPropertyMappings. Its error message is unique.TestOpenApiClientRequests.testInvalidJsonIsExternalErrorandtestReadsResponsesWithLoggedBodieshave the same message, but the second one runs with body logging on.