-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Update resource manager auto config and add testcases #25206
Conversation
@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(), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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,
Line 25 in 15dda6c
@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 |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
/azp run java - spring - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Fixes #21593
Changelog:
TODO:
The property 'spring.cloud.azure.xxx.profile.cloud=azure_china' in each service properties is not working yet.