Skip to content

Commit

Permalink
Use Common Sanitizers (#39935)
Browse files Browse the repository at this point in the history
* target the version of the proxy using the common sanitizers

* Update eng/target_proxy_version.txt

* use newest proxy version

* newest version with fixed token

* update for tests

* revert

* Update target_proxy_version.txt

* Add removeSanitizer API, with default removed list + azure-core-test update

* update core-test dep

* sendRequestWithRetries for playback requests

* added $..name removable sanitizer

* add AZSDK2003 to set of removed sanitizers

* disable specific test sanitizers

* fix appconfig, search and remove disable sanitizer for storage

* mark some search test live only

* fix storage, attestation, resourcemanager, phonenumbers

* resourcemanager-msi and storage-datalake fix

* can we try a version of the proxy that locks the session sanitizers when cloning them?

* enable removesanitizer on record

* Update target_proxy_version.txt

* fix KV, quantum jobs and resourcemanager

* make logs ingestion testUploadFailure LiveOnly

* mark timout resourcemanager test live only

* update monitor ingestion tests

* update monitor hearbeat test init delay

* marking heartBeatPayloadContainsDataByDefault LiveOnly

* disable canSendKnownLengthNoBufferAsyncFluxBinaryData

* fix monitor tests

---------

Co-authored-by: Sameeksha Vaity (from Dev Box) <savaity@microsoft.com>
Co-authored-by: Vinay Gera <vigera@microsoft.com>
  • Loading branch information
3 people committed May 17, 2024
1 parent f4af71c commit 5c5bf97
Show file tree
Hide file tree
Showing 310 changed files with 667 additions and 327 deletions.
2 changes: 1 addition & 1 deletion eng/target_proxy_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0-dev.20240410.1
1.0.0-dev.20240514.2
1 change: 1 addition & 0 deletions eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ io.clientcore:http-stress;1.0.0-beta.1;1.0.0-beta.1
# note: The unreleased dependencies will not be manipulated with the automatic PR creation code.
# In the pom, the version update tag after the version should name the unreleased package and the dependency version:
# <!-- {x-version-update;unreleased_com.azure:azure-core;dependency} -->
unreleased_com.azure:azure-core-test;1.26.0-beta.1

# Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current
# version and set the version to the released beta. Released beta dependencies are only valid
Expand Down
2 changes: 1 addition & 1 deletion sdk/advisor/azure-resourcemanager-advisor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion sdk/agrifood/azure-resourcemanager-agrifood/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion sdk/agrifood/azure-verticals-agrifood-farming/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion sdk/anomalydetector/azure-ai-anomalydetector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion sdk/apicenter/azure-resourcemanager-apicenter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion sdk/appconfiguration/azure-data-appconfiguration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

import java.util.Arrays;

import static com.azure.data.appconfiguration.ConfigurationClientTestBase.FAKE_CONNECTION_STRING;
import static com.azure.data.appconfiguration.TestHelper.DISPLAY_NAME_WITH_ARGUMENTS;

Expand Down Expand Up @@ -52,8 +54,14 @@ private void setup(HttpClient httpClient, ConfigurationServiceVersion serviceVer
builder.addPolicy(interceptorManager.getRecordPolicy()); // Record
}


client = builder.buildClient();
}

// Disable `("$.key")` sanitizer
if (!interceptorManager.isLiveMode()) {
interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
}
}

ConfigurationClientBuilder setHttpClient(HttpClient httpClient, ConfigurationClientBuilder builder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ private ConfigurationAsyncClient getConfigurationAsyncClient(HttpClient httpClie
builder.addPolicy(interceptorManager.getRecordPolicy());
} else if (interceptorManager.isPlaybackMode()) {
interceptorManager.addMatchers(Collections.singletonList(
new CustomMatcher().setHeadersKeyOnlyMatch(Collections.singletonList("Sync-Token"))));
new CustomMatcher().setHeadersKeyOnlyMatch(Arrays.asList("Sync-Token", "If-Match"))));
}

// Disable `$.key` snanitizer
if (!interceptorManager.isLiveMode()) {
interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
}
return builder.buildAsyncClient();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ public void nullServiceVersion(HttpClient httpClient) {
.httpClient(httpClient)
.addPolicy(interceptorManager.getRecordPolicy());
}
// Disable `("$.key")` sanitizer
if (!interceptorManager.isLiveMode()) {
interceptorManager.removeSanitizers(Collections.singletonList("AZSDK3447"));
}

ConfigurationSetting addedSetting = clientBuilder.buildClient().setConfigurationSetting(key, null, value);
assertEquals(addedSetting.getKey(), key);
Expand Down Expand Up @@ -229,6 +233,11 @@ public void defaultPipeline() {
clientBuilder.httpClient(interceptorManager.getPlaybackClient());
}

// Disable `("$.key")` sanitizer
if (!interceptorManager.isLiveMode()) {
interceptorManager.removeSanitizers(Collections.singletonList("AZSDK3447"));
}

ConfigurationSetting addedSetting = clientBuilder
.buildClient()
.setConfigurationSetting(key, null, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ private ConfigurationClient getConfigurationClient(HttpClient httpClient,
builder.addPolicy(interceptorManager.getRecordPolicy());
} else if (interceptorManager.isPlaybackMode()) {
interceptorManager.addMatchers(Collections.singletonList(
new CustomMatcher().setHeadersKeyOnlyMatch(Collections.singletonList("Sync-Token"))));
new CustomMatcher().setHeadersKeyOnlyMatch(Arrays.asList("Sync-Token", "If-Match"))));
}

// Disable `$.key` snanitizer
if (!interceptorManager.isLiveMode()) {
interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
}
return builder.buildClient();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion sdk/astro/azure-resourcemanager-astro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion sdk/attestation/azure-resourcemanager-attestation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion sdk/attestation/azure-security-attestation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.azure.core.http.HttpClient;
import com.azure.core.http.rest.Response;
import com.azure.core.test.annotation.LiveOnly;
import com.azure.core.util.Context;
import com.azure.security.attestation.models.AttestationSigner;
import com.azure.security.attestation.models.AttestationSignerCollection;
Expand All @@ -26,7 +27,9 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

@LiveOnly
public class AttestationPolicyManagementTests extends AttestationClientTestBase {
// LiveOnly because "JWT cannot be stored in recordings."
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("getAttestationClients")
void testGetPolicyManagementCertificates(HttpClient httpClient, String clientUri) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.azure.core.http.HttpClient;
import com.azure.core.http.rest.Response;
import com.azure.core.test.annotation.LiveOnly;
import com.azure.core.util.Base64Util;
import com.azure.core.util.BinaryData;
import com.azure.core.util.Context;
Expand All @@ -30,7 +31,9 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

@LiveOnly
public class AttestationPolicyTests extends AttestationClientTestBase {
// LiveOnly because "JWT cannot be stored in recordings."
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("getPolicyClients")
void testGetAttestationPolicy(HttpClient client, String clientUri, AttestationType attestationType) {
Expand Down Expand Up @@ -372,6 +375,7 @@ void testSetAttestationPolicyAsync(HttpClient httpClient, String clientUri, Atte
}
}

@LiveOnly
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("getPolicyClients")
void testSetAttestationPolicyAadAsync(HttpClient httpClient, String clientUri, AttestationType attestationType) {
Expand All @@ -397,6 +401,7 @@ void testSetAttestationPolicyAadAsync(HttpClient httpClient, String clientUri, A
.verify();
}

@LiveOnly
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("getPolicyClients")
void testSetAttestationPolicyWithResponseAsync(HttpClient httpClient, String clientUri,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.azure.core.http.HttpHeaders;
import com.azure.core.http.rest.Response;
import com.azure.core.test.TestMode;
import com.azure.core.test.annotation.LiveOnly;
import com.azure.core.test.utils.TestUtils;
import com.azure.core.util.BinaryData;
import com.azure.core.util.Context;
Expand Down Expand Up @@ -46,7 +47,9 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

@LiveOnly
public class AttestationTest extends AttestationClientTestBase {
// LiveOnly because "JWT cannot be stored in recordings."
private static final String RUNTIME_DATA = "CiAgICAgICAgewogICAgICAgICAgICAiandrIiA6IHsKICAgICAgICAgICAgICAgICJrdHk"
+ "iOiJFQyIsCiAgICAgICAgICAgICAgICAidXNlIjoic2lnIiwKICAgICAgICAgICAgICAgICJjcnYiOiJQLTI1NiIsCiAgICAgICAgICAgICA"
+ "gICAieCI6IjE4d0hMZUlnVzl3Vk42VkQxVHhncHF5MkxzellrTWY2SjhualZBaWJ2aE0iLAogICAgICAgICAgICAgICAgInkiOiJjVjRkUzR"
Expand Down
2 changes: 1 addition & 1 deletion sdk/avs/azure-resourcemanager-avs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion sdk/azurestack/azure-resourcemanager-azurestack/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion sdk/batch/azure-resourcemanager-batch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion sdk/billing/azure-resourcemanager-billing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion sdk/chaos/azure-resourcemanager-chaos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion sdk/commerce/azure-resourcemanager-commerce/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.25.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<version>1.26.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down

0 comments on commit 5c5bf97

Please sign in to comment.