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

Update resource manager auto config and add testcases #25206

Conversation

moarychan
Copy link
Member

@moarychan moarychan commented Nov 5, 2021

Fixes #21593

Changelog:

  • Fix tested issue and add resource manager test cases
  • Add azure cloud platform test cases

TODO:
The property 'spring.cloud.azure.xxx.profile.cloud=azure_china' in each service properties is not working yet.

@ghost ghost added the azure-spring All azure-spring related issues label Nov 5, 2021
@moarychan moarychan marked this pull request as ready for review November 8, 2021 06:25
Comment on lines 68 to 98
@Test
void testAzureProfileWithAzureDefault() {
this.contextRunner
.withUserConfiguration(AzureGlobalPropertiesAutoConfiguration.class)
.withBean(AzureResourceManager.class, AzureResourceManagerExt::getAzureResourceManager)
.withPropertyValues(
"spring.cloud.azure.profile.tenant-id=test-tenant-id",
"spring.cloud.azure.profile.subscription-id=test-subscription-id"
)
.run(context -> {
assertThat(context).hasSingleBean(AzureProfile.class);
AzureProfile azureProfile = context.getBean(AzureProfile.class);
Assertions.assertEquals(azureProfile.getEnvironment().getActiveDirectoryEndpoint(),
AZURE.getActiveDirectoryEndpoint());
});
}

@Test
void testAzureProfileWithAzureChina() {
this.contextRunner
.withUserConfiguration(AzureGlobalPropertiesAutoConfiguration.class)
.withBean(AzureResourceManager.class, AzureResourceManagerExt::getAzureResourceManager)
.withPropertyValues(
"spring.cloud.azure.profile.tenant-id=test-tenant-id",
"spring.cloud.azure.profile.subscription-id=test-subscription-id",
"spring.cloud.azure.profile.cloud=AZURE_CHINA"
)
.run(context -> {
assertThat(context).hasSingleBean(AzureProfile.class);
AzureProfile azureProfile = context.getBean(AzureProfile.class);
Assertions.assertEquals(azureProfile.getEnvironment().getActiveDirectoryEndpoint(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume these two properties are not relevant to resource manager?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean the tenant-id and subscription-id? it's required for AzureResourceManagerAutoConfiguration,

@ConditionalOnProperty({ "spring.cloud.azure.profile.tenant-id", "spring.cloud.azure.profile.subscription-id" })

private final String connectionString = "connection-string=Endpoint=sb://test.servicebus.windows.net/;"
+ "SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=ByyyxxxUw=";

@Test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should also be a test case where the resource manager bean be auto-configured correctly?


import static org.assertj.core.api.Assertions.assertThat;

public class AzureStorageQueueResourceManagerAutoConfigurationTest {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this one, also same for the eh resource manager.

@saragluna
Copy link
Member

/azp run java - spring - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@saragluna saragluna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@saragluna saragluna merged commit 37c7c01 into Azure:feature/azure-spring-cloud-4.0 Nov 9, 2021
@moarychan moarychan linked an issue Nov 10, 2021 that may be closed by this pull request
@moarychan moarychan deleted the moary/fix-tested-issues-in-4.0 branch December 3, 2021 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure-spring All azure-spring related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Spring]Support to config different Azure clouds than Azure public
2 participants