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

Change tests to only preclude live, not expect playback #40034

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
import com.azure.core.http.HttpClient;
import com.azure.identity.ClientAssertionCredential;
import com.azure.identity.ClientAssertionCredentialBuilder;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import reactor.test.StepVerifier;


import static org.junit.jupiter.api.Assertions.assertNotNull;

public class ClientAssertionCredentialTest extends IdentityTestBase {
Expand All @@ -32,7 +31,8 @@ private void initializeClient(HttpClient httpClient) {

@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("getHttpClients")
@EnabledIfEnvironmentVariable(named = "AZURE_TEST_MODE", matches = "PLAYBACK")

@DisabledIfEnvironmentVariable(named = "AZURE_TEST_MODE", matches = "LIVE")
public void getToken(HttpClient httpClient) {
// arrange
initializeClient(httpClient);
Expand All @@ -48,7 +48,7 @@ public void getToken(HttpClient httpClient) {

@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("getHttpClients")
@EnabledIfEnvironmentVariable(named = "AZURE_TEST_MODE", matches = "PLAYBACK")
@DisabledIfEnvironmentVariable(named = "AZURE_TEST_MODE", matches = "LIVE")
public void getTokenAsync(HttpClient httpClient) {
// arrange
initializeClient(httpClient);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.azure.core.util.Configuration;
import com.azure.identity.ClientCertificateCredential;
import com.azure.identity.ClientCertificateCredentialBuilder;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import reactor.test.StepVerifier;
Expand All @@ -34,7 +34,7 @@ private void initializeClient(HttpClient httpClient) {

@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("getHttpClients")
@EnabledIfEnvironmentVariable(named = "AZURE_TEST_MODE", matches = "PLAYBACK")
@DisabledIfEnvironmentVariable(named = "AZURE_TEST_MODE", matches = "LIVE")
public void getToken(HttpClient httpClient) {
// arrange
initializeClient(httpClient);
Expand All @@ -50,7 +50,7 @@ public void getToken(HttpClient httpClient) {

@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("getHttpClients")
@EnabledIfEnvironmentVariable(named = "AZURE_TEST_MODE", matches = "PLAYBACK")
@DisabledIfEnvironmentVariable(named = "AZURE_TEST_MODE", matches = "LIVE")
public void getTokenAsync(HttpClient httpClient) {
// arrange
initializeClient(httpClient);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.azure.core.http.HttpClient;
import com.azure.identity.ClientSecretCredential;
import com.azure.identity.ClientSecretCredentialBuilder;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import reactor.test.StepVerifier;
Expand All @@ -32,7 +32,7 @@ private void initializeClient(HttpClient httpClient) {

@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("getHttpClients")
@EnabledIfEnvironmentVariable(named = "AZURE_TEST_MODE", matches = "PLAYBACK")
@DisabledIfEnvironmentVariable(named = "AZURE_TEST_MODE", matches = "LIVE")
public void getToken(HttpClient httpClient) {
// arrange
initializeClient(httpClient);
Expand All @@ -48,7 +48,7 @@ public void getToken(HttpClient httpClient) {

@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("getHttpClients")
@EnabledIfEnvironmentVariable(named = "AZURE_TEST_MODE", matches = "PLAYBACK")
@DisabledIfEnvironmentVariable(named = "AZURE_TEST_MODE", matches = "LIVE")
public void getTokenAsync(HttpClient httpClient) {
// arrange
initializeClient(httpClient);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.azure.core.util.Configuration;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

Expand Down Expand Up @@ -62,7 +63,7 @@ HttpPipeline getHttpPipeline(HttpClient httpClient) {
if (interceptorManager.isPlaybackMode()) {
List<TestProxyRequestMatcher> customMatchers = new ArrayList<>();
customMatchers.add(new BodilessMatcher());
customMatchers.add(new CustomMatcher().setExcludedHeaders(Collections.singletonList("X-MRC-CV")));
customMatchers.add(new CustomMatcher().setExcludedHeaders(Arrays.asList("X-MRC-CV", "x-client-CPU")));
interceptorManager.addMatchers(customMatchers);
}

Expand Down