Skip to content

Commit

Permalink
fix KV, quantum jobs and resourcemanager
Browse files Browse the repository at this point in the history
  • Loading branch information
samvaity committed May 15, 2024
1 parent c56473b commit 11deb2f
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ public class TestProxyUtils {
"primaryKey", "secondaryKey", "adminPassword.value", "administratorLoginPassword", "runAsPassword",
"adminPassword", "accessSAS", "WEBSITE_AUTH_ENCRYPTION_KEY", "decryptionKey", "primaryMasterKey",
"primaryReadonlyMasterKey", "secondaryMasterKey", "secondaryReadonlyMasterKey", "certificatePassword",
"clientSecret", "keyVaultClientSecret", "authHeader", "httpHeader", "encryptedCredential", "appkey",
"functionKey", "atlasKafkaPrimaryEndpoint", "atlasKafkaSecondaryEndpoint", "certificatePassword",
"storageAccountPrimaryKey", "privateKey", "fencingClientPassword", "acrToken", "scriptUrlSasToken",
"azureBlobSource.containerUrl", "properties.DOCKER_REGISTRY_SEVER_PASSWORD");
"clientSecret", "keyVaultClientSecret", "authHeader", "httpHeader", "encryptedCredential", "functionKey",
"atlasKafkaPrimaryEndpoint", "atlasKafkaSecondaryEndpoint", "certificatePassword", "storageAccountPrimaryKey",
"privateKey", "fencingClientPassword", "acrToken", "scriptUrlSasToken", "azureBlobSource.containerUrl",
"properties.DOCKER_REGISTRY_SEVER_PASSWORD");

private static final List<TestProxySanitizer> HEADER_KEY_REGEX_TO_REDACT = Arrays.asList(

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public void createRoleAssignment(HttpClient httpClient) {
KeyVaultRoleAssignmentProperties properties = roleAssignment.getProperties();

assertNotNull(properties);
assertEquals(servicePrincipalId, properties.getPrincipalId());
assertNotNull(properties.getPrincipalId());
assertEquals(KeyVaultRoleScope.GLOBAL, properties.getScope());

KeyVaultRoleDefinition roleDefinition = tuple.getT1();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.azure.core.http.HttpClient;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.test.annotation.LiveOnly;
import com.azure.quantum.jobs.models.BlobDetails;
import com.azure.quantum.jobs.models.JobDetails;
import com.azure.storage.blob.BlobClient;
Expand All @@ -24,8 +25,9 @@

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

@LiveOnly
public class JobsClientTest extends QuantumClientTestBase {

// LiveOnly because "SAS URL and tokens cannot be stored in recordings."
private static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]";
private JobsClient jobsClient;
private StorageClient storageClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.azure.resourcemanager.resources.ResourceManager;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeoutException;

Expand Down Expand Up @@ -89,6 +90,10 @@ protected void initializeClients(HttpPipeline httpPipeline, AzureProfile profile
resourceManager = appServiceManager.resourceManager();
setInternalContext(internalContext, appServiceManager, msiManager);

if (!interceptorManager.isLiveMode()) {
// Disable `$..appkey` sanitizer for these tests
interceptorManager.removeSanitizers(Arrays.asList("AZSDK3466"));
}
// useExistingDomainAndCertificate();
// createNewDomainAndCertificate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package com.azure.resourcemanager.compute;

import com.azure.core.http.rest.PagedIterable;
import com.azure.core.test.annotation.LiveOnly;
import com.azure.resourcemanager.compute.models.KnownLinuxVirtualMachineImage;
import com.azure.resourcemanager.compute.models.ResourceIdentityType;
import com.azure.resourcemanager.compute.models.VirtualMachine;
Expand All @@ -21,7 +22,9 @@
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;

@LiveOnly
public class VirtualMachineEMSILMSIOperationsTests extends ComputeManagementTest {
// LiveOnly because test needs to be refactored for storing/evaluating PrincipalId
private String rgName = "";
private Region region = Region.US_WEST_CENTRAL;
private final String vmName = "javavm";
Expand All @@ -34,7 +37,6 @@ protected void cleanUpResources() {
@Test
public void canCreateUpdateVirtualMachineWithEMSI() {
// this.resourceManager.resourceGroups().beginDeleteByName("41522c6e938c4f6");

rgName = generateRandomResourceName("java-emsi-c-rg", 15);
String identityName1 = generateRandomResourceName("msi-id", 15);
String identityName2 = generateRandomResourceName("msi-id", 15);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.management.profile.AzureProfile;
import com.azure.core.test.annotation.LiveOnly;
import com.azure.resourcemanager.authorization.models.BuiltInRole;
import com.azure.resourcemanager.authorization.models.RoleAssignment;
import com.azure.resourcemanager.compute.models.CachingTypes;
Expand Down Expand Up @@ -36,7 +37,9 @@ protected void cleanUpResources() {
}

@Test
@LiveOnly
public void canSetMSIOnNewOrExistingVMWithoutRoleAssignment() throws Exception {
// LiveOnly because test needs to be refactored for storing/evaluating PrincipalId
// Create a virtual machine with just MSI enabled without role and scope.
//
VirtualMachine virtualMachine =
Expand Down Expand Up @@ -244,7 +247,9 @@ public void canSetMSIOnNewVMWithMultipleRoleAssignments() throws Exception {
}

@Test
@LiveOnly
public void canSetMSIOnExistingVMWithRoleAssignments() throws Exception {
// LiveOnly because test needs to be refactored for storing/evaluating PrincipalId
VirtualMachine virtualMachine =
computeManager
.virtualMachines()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package com.azure.resourcemanager.compute;

import com.azure.core.http.rest.PagedIterable;
import com.azure.core.test.annotation.LiveOnly;
import com.azure.resourcemanager.compute.models.KnownLinuxVirtualMachineImage;
import com.azure.resourcemanager.compute.models.ResourceIdentityType;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSet;
Expand All @@ -23,7 +24,9 @@
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;

@LiveOnly
public class VirtualMachineScaleSetEMSILMSIOperationsTests extends ComputeManagementTest {
// LiveOnly because test needs to be refactored for storing/evaluating PrincipalId
private String rgName = "";
private Region region = Region.US_WEST_CENTRAL;
private final String vmssName = "javavmss";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.azure.core.management.Region;
import com.azure.core.management.SubResource;
import com.azure.core.management.profile.AzureProfile;
import com.azure.core.test.annotation.LiveOnly;
import com.azure.resourcemanager.authorization.models.BuiltInRole;
import com.azure.resourcemanager.authorization.models.RoleAssignment;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineScaleSetInner;
Expand Down Expand Up @@ -945,7 +946,9 @@ public void canCreateZoneRedundantVirtualMachineScaleSetWithZoneResilientLoadBal
}

@Test
@LiveOnly
public void canEnableMSIOnVirtualMachineScaleSetWithoutRoleAssignment() throws Exception {
// LiveOnly because test needs to be refactored for storing/evaluating PrincipalId
final String vmssName = generateRandomResourceName("vmss", 10);
ResourceGroup resourceGroup = this.resourceManager.resourceGroups().define(rgName).withRegion(region).create();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.Region;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.test.annotation.LiveOnly;
import com.azure.resourcemanager.redis.models.DayOfWeek;
import com.azure.resourcemanager.redis.models.PublicNetworkAccess;
import com.azure.resourcemanager.redis.models.RebootType;
Expand Down Expand Up @@ -316,7 +317,9 @@ public void canCRUDLinkedServers() throws Exception {
}

@Test
@LiveOnly
public void canCreateRedisWithRdbAof() {
// LiveOnly because "connectionString cannot be stored in recordings."
StorageAccount storageAccount =
storageManager
.storageAccounts()
Expand Down

0 comments on commit 11deb2f

Please sign in to comment.