Skip to content

Commit 0a854e8

Browse files
authored
Re-enable test proxy unit tests (Azure#33855)
* Re-enable test proxy unit tests The failure was caused by the fact that these tests effectively override the `AZURE_TEST_MODE` variable so they can test record and playback in the same session. The mechanism for doing so is later than when the test proxy started, so the sequence of events is: ``` AZURE_TEST_MODE=LIVE skip starting test proxy AZURE_TEST_MODE=PLAYBACK (within a test) try to talk to test proxy. ``` This isn't a concern for real tests, as they will have a consistent mode throughout. * cleanup
1 parent 1672b9c commit 0a854e8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sdk/core/azure-core-test/src/test/java/com/azure/core/test/TestProxyTests.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
import com.fasterxml.jackson.databind.SerializationFeature;
2525
import org.junit.jupiter.api.AfterAll;
2626
import org.junit.jupiter.api.BeforeAll;
27-
import org.junit.jupiter.api.Disabled;
2827
import org.junit.jupiter.api.Tag;
2928
import org.junit.jupiter.api.Test;
29+
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
3030

3131
import java.io.BufferedReader;
3232
import java.io.File;
@@ -49,7 +49,10 @@
4949
/**
5050
* Test class for testing Test proxy functionality of record, playback and redaction.
5151
*/
52-
@Disabled
52+
53+
// These tests override the environment variable so they can test playback and record in the same test run.
54+
// This strategy fails if we are in a LIVE test mode, so we'll just skip these entirely if that's the case.
55+
@DisabledIfEnvironmentVariable(named = "AZURE_TEST_MODE", matches = "(LIVE|live|Live)")
5356
public class TestProxyTests extends TestProxyTestBase {
5457
static TestProxyTestServer server;
5558
private static final ObjectMapper RECORD_MAPPER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);

0 commit comments

Comments
 (0)