-
Notifications
You must be signed in to change notification settings - Fork 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
Add Live TestMode and Skip Recording Concepts #6134
Conversation
… teardown if test was skipped
/azp run java - storage - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run java - storage - tests |
Azure Pipelines failed to run 1 pipeline(s). |
/azp run java - storage - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run java - appconfiguration - tests |
/azp run java - storage - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run java - storage - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Do we actually need the doNotRecord flag?
Is this a duplicate concept with LIVE?
Can I have an example which RECORD or PLAYBACK have to set DoNotRecord to true but it does not apply to LIVE?
return Objects.requireNonNull(client); | ||
if (testMode == TestMode.PLAYBACK && !testRunVerifier.doNotRecordTest()) { | ||
clientBuilder.httpClient(interceptorManager.getPlaybackClient()); | ||
} else if (testMode == TestMode.RECORD && !testRunVerifier.doNotRecordTest()) { |
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.
What's the reason to check test testRunVerifier.doNotRecordTest()?
If we don't want record, can we simply setup env to LIVE
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.
LIVE
and DoNotRecord
serve slightly different but related purposes. LIVE
won't record anything but the DoNotRecord
annotation is meant for tests that shouldn't have any data recorded.
if (testMode == TestMode.PLAYBACK && !testRunVerifier.doNotRecordTest()) { | ||
clientBuilder.httpClient(interceptorManager.getPlaybackClient()); | ||
} else if (testMode == TestMode.RECORD && !testRunVerifier.doNotRecordTest()) { | ||
clientBuilder.httpClient(new NettyAsyncHttpClientBuilder().wiretap(true).build()) |
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 one applies to LIVE mode. Better to put in both RECORD and LIVE
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.
LIVE
won't need Netty wiretap set to true as it doesn't need to inspect the request or response for recording purposes.
/azp run java - storage - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
*/ | ||
@Retention(RUNTIME) | ||
@Target({METHOD}) | ||
public @interface DoNotRecord { |
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.
Just for my understanding, why would any test run only in live mode but shouldn't be recorded?
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.
Tests that contain information that cannot be recorded into a playback JSON such as random UUIDs generated by methods called.
Closing in favor of #6671 |
Implements #5174
This PR introduces two new concepts to the Azure Core testing framework.
A new value
LIVE
was added to theTestMode
enum. This state is used to indicate that tests should be ran against a live service without recording the network calls, this is meant to help reduce the overhead of testing by removing the recording process. The use case for this change is to remove recording tests during the nightly validation and in cases where sensitive information that hasn't been masked is being sent during testing.A new test annotation,
DoNotRecord
, was added. This annotation is meant to be used with tests that don't want their network calls record or they make no network calls but surrounding testing infrastructure does. This annotation has an optional parameter ofskipInPlayback
which is meant to be used with tests that make network calls but won't be recorded due to the inability to redact sensitive data or they call into code paths that cannot be mocked.