Skip to content

Commit

Permalink
mark some search test live only
Browse files Browse the repository at this point in the history
  • Loading branch information
samvaity committed May 13, 2024
1 parent 03c87d4 commit 854c06f
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ protected JobRouterAdministrationClient getRouterAdministrationClient(HttpClient
.endpoint(connectionString.getEndpoint())
.pipeline(httpPipeline)
.buildClient();
// Disable `$..etag` sanitizer
if (!interceptorManager.isLiveMode()) {
interceptorManager.removeSanitizers(Arrays.asList("AZSDK3490"));
}
return jobRouterAdministrationClient;
}

Expand All @@ -67,6 +71,10 @@ protected JobRouterAdministrationAsyncClient getRouterAdministrationAsyncClient(
.endpoint(connectionString.getEndpoint())
.pipeline(httpPipeline)
.buildAsyncClient();
// Disable `$..etag` sanitizer
if (!interceptorManager.isLiveMode()) {
interceptorManager.removeSanitizers(Arrays.asList("AZSDK3490"));
}
return jobRouterAdministrationAsyncClient;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.azure.ai.metricsadvisor.administration.models.DataSourceAuthenticationType;
import com.azure.ai.metricsadvisor.administration.models.DataSourceCredentialEntity;
import com.azure.core.http.HttpClient;
import com.azure.core.test.annotation.LiveOnly;
import com.azure.core.util.CoreUtils;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
Expand All @@ -21,6 +22,7 @@
import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS;
import static org.junit.jupiter.api.Assertions.assertEquals;

@LiveOnly
public class DatasourceCredentialAsyncTest extends DatasourceCredentialTestBase {
private MetricsAdvisorAdministrationAsyncClient client;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.azure.ai.metricsadvisor.administration.models.DataSourceCredentialEntity;
import com.azure.core.http.HttpClient;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.test.annotation.LiveOnly;
import com.azure.core.util.CoreUtils;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
Expand All @@ -20,6 +21,7 @@
import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS;
import static org.junit.jupiter.api.Assertions.assertEquals;

@LiveOnly
public class DatasourceCredentialTest extends DatasourceCredentialTestBase {
private MetricsAdvisorAdministrationClient client;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ void validateCredentialResult(DataSourceCredentialEntity expectedCredential,
DataSourceServicePrincipal actualCredentialSP = (DataSourceServicePrincipal) actualCredential;
assertNotNull(actualCredentialSP.getClientId());
assertNotNull(actualCredentialSP.getTenantId());
assertEquals(((DataSourceServicePrincipal) expectedCredential).getClientId(),
actualCredentialSP.getClientId());
assertEquals(((DataSourceServicePrincipal) expectedCredential).getTenantId(),
actualCredentialSP.getTenantId());
} else if (credentialType == DataSourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV) {
Expand All @@ -123,7 +125,16 @@ void validateCredentialResult(DataSourceCredentialEntity expectedCredential,
assertNotNull(actualCredentialSPInKV.getTenantId());
assertNotNull(actualCredentialSPInKV.getSecretNameForDataSourceClientId());
assertNotNull(actualCredentialSPInKV.getSecretNameForDataSourceClientSecret());
assertNotNull(actualCredentialSPInKV.getKeyVaultClientId());
assertEquals(((DataSourceServicePrincipalInKeyVault) expectedCredential).getKeyVaultClientId(),
actualCredentialSPInKV.getKeyVaultClientId());
assertEquals(((DataSourceServicePrincipalInKeyVault) expectedCredential).getTenantId(),
actualCredentialSPInKV.getTenantId());
assertEquals(((DataSourceServicePrincipalInKeyVault) expectedCredential)
.getSecretNameForDataSourceClientId(),
actualCredentialSPInKV.getSecretNameForDataSourceClientId());
assertEquals(((DataSourceServicePrincipalInKeyVault) expectedCredential)
.getSecretNameForDataSourceClientSecret(),
actualCredentialSPInKV.getSecretNameForDataSourceClientSecret());
} else {
throw new IllegalStateException("Unexpected value for DataSourceCredentialType: " + credentialType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.azure.core.models.GeoPoint;
import com.azure.core.test.TestBase;
import com.azure.core.test.TestMode;
import com.azure.core.test.annotation.LiveOnly;
import com.azure.core.util.Context;
import com.azure.search.documents.indexes.SearchIndexClient;
import com.azure.search.documents.indexes.models.IndexDocumentsBatch;
Expand Down Expand Up @@ -120,7 +121,12 @@ public void countingDocsOfNewIndexGivesZeroAsync() {
}

@Test
@LiveOnly
public void indexDoesNotThrowWhenAllActionsSucceedSync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchClient client = getClient(HOTEL_INDEX_NAME);

String expectedHotelId = getRandomDocumentKey();
Expand All @@ -131,7 +137,12 @@ public void indexDoesNotThrowWhenAllActionsSucceedSync() {
}

@Test
@LiveOnly
public void indexDoesNotThrowWhenAllActionsSucceedAsync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchAsyncClient asyncClient = getAsyncClient(HOTEL_INDEX_NAME);

String expectedHotelId = getRandomDocumentKey();
Expand All @@ -143,7 +154,12 @@ public void indexDoesNotThrowWhenAllActionsSucceedAsync() {
}

@Test
@LiveOnly
public void canIndexWithPascalCaseFieldsSync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchClient client = getClient(BOOKS_INDEX_NAME);

String isbn = getRandomDocumentKey();
Expand All @@ -160,7 +176,12 @@ public void canIndexWithPascalCaseFieldsSync() {
}

@Test
@LiveOnly
public void canIndexWithPascalCaseFieldsAsync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchAsyncClient asyncClient = getAsyncClient(BOOKS_INDEX_NAME);

String isbn = getRandomDocumentKey();
Expand All @@ -178,7 +199,12 @@ public void canIndexWithPascalCaseFieldsAsync() {
}

@Test
@LiveOnly
public void canDeleteBatchByKeysSync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchClient client = getClient(HOTEL_INDEX_NAME);

String hotel1Key = getRandomDocumentKey();
Expand All @@ -199,7 +225,12 @@ public void canDeleteBatchByKeysSync() {
}

@Test
@LiveOnly
public void canDeleteBatchByKeysAsync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchAsyncClient asyncClient = getAsyncClient(HOTEL_INDEX_NAME);

String hotel1Key = getRandomDocumentKey();
Expand All @@ -223,7 +254,12 @@ public void canDeleteBatchByKeysAsync() {
}

@Test
@LiveOnly
public void indexDoesNotThrowWhenDeletingDocumentWithExtraFieldsSync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchClient client = getClient(HOTEL_INDEX_NAME);

String hotelId = getRandomDocumentKey();
Expand All @@ -243,7 +279,12 @@ public void indexDoesNotThrowWhenDeletingDocumentWithExtraFieldsSync() {
}

@Test
@LiveOnly
public void indexDoesNotThrowWhenDeletingDocumentWithExtraFieldsAsync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchAsyncClient asyncClient = getAsyncClient(HOTEL_INDEX_NAME);

String hotelId = getRandomDocumentKey();
Expand All @@ -266,7 +307,12 @@ public void indexDoesNotThrowWhenDeletingDocumentWithExtraFieldsAsync() {
}

@Test
@LiveOnly
public void indexDoesNotThrowWhenDeletingDynamicDocumentWithExtraFieldsSync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchClient client = getClient(HOTEL_INDEX_NAME);

String hotelId = getRandomDocumentKey();
Expand All @@ -287,7 +333,12 @@ public void indexDoesNotThrowWhenDeletingDynamicDocumentWithExtraFieldsSync() {
}

@Test
@LiveOnly
public void indexDoesNotThrowWhenDeletingDynamicDocumentWithExtraFieldsAsync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchAsyncClient asyncClient = getAsyncClient(HOTEL_INDEX_NAME);

String hotelId = getRandomDocumentKey();
Expand All @@ -310,7 +361,12 @@ public void indexDoesNotThrowWhenDeletingDynamicDocumentWithExtraFieldsAsync() {
}

@Test
@LiveOnly
public void canIndexStaticallyTypedDocumentsSync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchClient client = getClient(HOTEL_INDEX_NAME);

String hotel1Id = getRandomDocumentKey();
Expand Down Expand Up @@ -348,7 +404,12 @@ public void canIndexStaticallyTypedDocumentsSync() {
}

@Test
@LiveOnly
public void canIndexStaticallyTypedDocumentsAsync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchAsyncClient asyncClient = getAsyncClient(HOTEL_INDEX_NAME);

String hotel1Id = getRandomDocumentKey();
Expand Down Expand Up @@ -390,7 +451,12 @@ public void canIndexStaticallyTypedDocumentsAsync() {


@Test
@LiveOnly
public void canIndexDynamicDocumentsNotThrowSync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchClient client = getClient(HOTEL_INDEX_NAME);

String hotel1Id = getRandomDocumentKey();
Expand Down Expand Up @@ -426,7 +492,12 @@ public void canIndexDynamicDocumentsNotThrowSync() {
}

@Test
@LiveOnly
public void canIndexDynamicDocumentsNotThrowAsync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchAsyncClient asyncClient = getAsyncClient(HOTEL_INDEX_NAME);

String hotel1Id = getRandomDocumentKey();
Expand Down Expand Up @@ -465,7 +536,12 @@ public void canIndexDynamicDocumentsNotThrowAsync() {
}

@Test
@LiveOnly
public void canIndexDynamicDocumentsThrowOnErrorSync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchClient client = getClient(HOTEL_INDEX_NAME);

String hotel1Id = getRandomDocumentKey();
Expand Down Expand Up @@ -501,7 +577,12 @@ public void canIndexDynamicDocumentsThrowOnErrorSync() {
}

@Test
@LiveOnly
public void canIndexDynamicDocumentsThrowOnErrorAsync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchAsyncClient asyncClient = getAsyncClient(HOTEL_INDEX_NAME);

String hotel1Id = getRandomDocumentKey();
Expand Down Expand Up @@ -767,7 +848,12 @@ public void canMergeStaticallyTypedDocumentsAsync() {
}

@Test
@LiveOnly
public void mergeDocumentWithoutExistingKeyThrowsIndexingExceptionSync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchClient client = getClient(HOTEL_INDEX_NAME);

String hotelId = getRandomDocumentKey();
Expand All @@ -780,7 +866,12 @@ public void mergeDocumentWithoutExistingKeyThrowsIndexingExceptionSync() {
}

@Test
@LiveOnly
public void mergeDocumentWithoutExistingKeyThrowsIndexingExceptionAsync() {
// Disable `("$..key")` sanitizer
// if (!interceptorManager.isLiveMode()) {
// interceptorManager.removeSanitizers(Arrays.asList("AZSDK3447"));
// }
SearchAsyncClient asyncClient = getAsyncClient(HOTEL_INDEX_NAME);

String hotelId = getRandomDocumentKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

package com.azure.search.documents;

import com.azure.core.test.annotation.LiveOnly;
import com.azure.core.test.models.BodilessMatcher;
import com.azure.core.util.CoreUtils;
import com.azure.core.util.serializer.TypeReference;
Expand Down Expand Up @@ -306,6 +307,7 @@ public void batchGetsDocumentsButNeverFlushesAsync() {
}

@Test
@LiveOnly
public void indexManyDocumentsSmallDocumentSets() {
interceptorManager.addMatchers(Collections.singletonList(new BodilessMatcher()));

Expand Down Expand Up @@ -353,6 +355,7 @@ public void indexManyDocumentsSmallDocumentSets() {
}

@Test
@LiveOnly
public void indexManyDocumentsSmallDocumentSetsAsync() {
interceptorManager.addMatchers(Collections.singletonList(new BodilessMatcher()));

Expand Down Expand Up @@ -401,6 +404,7 @@ public void indexManyDocumentsSmallDocumentSetsAsync() {
}

@Test
@LiveOnly
public void indexManyDocumentsOneLargeDocumentSet() {
interceptorManager.addMatchers(Collections.singletonList(new BodilessMatcher()));

Expand Down Expand Up @@ -449,6 +453,7 @@ public void indexManyDocumentsOneLargeDocumentSet() {
}

@Test
@LiveOnly
public void indexManyDocumentsOneLargeDocumentSetAsync() {
interceptorManager.addMatchers(Collections.singletonList(new BodilessMatcher()));

Expand Down

0 comments on commit 854c06f

Please sign in to comment.