Skip to content

Commit

Permalink
Add integration test module for appconfiguration (Azure#15582)
Browse files Browse the repository at this point in the history
* Add test module for appconfiguration, and update tests.yml to run integration test for spring 2.2.x.
  • Loading branch information
Rujun Chen authored Oct 9, 2020
1 parent 90b5173 commit 7a099f0
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
####
# PRLabel: %App Configuration
/sdk/appconfiguration/ @mssfang @alzimmermsft
/sdk/appconfiguration/spring-cloud-azure-*/ @mrm9084 @saragluna @yiliuTo @chenrujun @zhoufenqin @jialindai
/sdk/appconfiguration/azure-spring-cloud-*/ @mrm9084 @saragluna @yiliuTo @chenrujun @zhoufenqin @jialindai

# PRLabel: %Batch
/sdk/batch/ @xingwu1 @bgklein @matthchr
Expand Down
1 change: 1 addition & 0 deletions eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ com.microsoft.azure:spring-cloud-azure-appconfiguration-config;1.2.8-beta.1;1.2.
com.microsoft.azure:spring-cloud-azure-feature-management-web;1.2.8-beta.1;1.2.8-beta.1
com.microsoft.azure:spring-cloud-azure-feature-management;1.2.8-beta.1;1.2.8-beta.1
com.microsoft.azure:spring-cloud-starter-azure-appconfiguration-config;1.2.8-beta.1;1.2.8-beta.1
com.microsoft.azure:spring-cloud-starter-azure-appconfiguration-config-test;1.2.8-beta.1;1.2.8-beta.1

# Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current
# version. Unreleased dependencies are only valid for dependency versions.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version> <!-- {x-version-update;org.springframework.boot:spring-boot-starter-parent;external_dependency} -->
<relativePath/> <!-- lookup parent from repository -->
</parent>

<groupId>com.microsoft.azure</groupId>
<artifactId>azure-spring-cloud-starter-appconfiguration-config-test</artifactId>
<version>1.2.8-beta.1</version> <!-- {x-version-update;com.microsoft.azure:azure-spring-cloud-starter-appconfiguration-config-test;current} -->

<dependencies>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>spring-cloud-starter-azure-appconfiguration-config</artifactId>
<version>1.2.8-beta.1</version> <!-- {x-version-update;com.microsoft.azure:spring-cloud-starter-azure-appconfiguration-config;current} -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.microsoft.azure.spring.cloud.config;

import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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

public class SampleIT {

private final Logger log = LoggerFactory.getLogger(SampleIT.class);
@Test
public void sampleTest() {
log.info("test log info.");
assertThat(true).isEqualTo(true);
}
}
4 changes: 4 additions & 0 deletions sdk/appconfiguration/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ extends:
- name: spring-cloud-starter-azure-appconfiguration-config
groupId: com.microsoft.azure
safeName: springcloudstarterazureappconfigurationconfig
AdditionalModules:
- name: azure-spring-cloud-starter-appconfiguration-config-test
groupId: com.microsoft.azure
safeName: azurespringcloudstarterappconfigurationconfigtest
1 change: 1 addition & 0 deletions sdk/appconfiguration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
<module>azure-spring-cloud-feature-management</module>
<module>azure-spring-cloud-feature-management-web</module>
<module>azure-spring-cloud-starter-appconfiguration-config</module>
<module>azure-spring-cloud-starter-appconfiguration-config-test</module>
</modules>
</project>
19 changes: 16 additions & 3 deletions sdk/appconfiguration/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,25 @@ jobs:
parameters:
ServiceDirectory: appconfiguration
Artifacts:
- name: azure-data-appconfiguration
groupId: com.azure
safeName: azuredataappconfiguration
- name: azure-spring-cloud-starter-appconfiguration-config-test
groupId: com.microsoft.azure
safeName: azurespringcloudstarterappconfigurationconfigtest
TimeoutInMinutes: 90
EnvVars:
AZURE_TEST_MODE: RECORD
AZURE_APPCONFIG_CONNECTION_STRING: $(AZURE_APPCONFIG_CONNECTION_STRING)
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret)
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
PostRunSteps:
- script: |
python --version
python -m pip install setuptools termcolor in_place
python sdk/spring/scripts/replace_util.py --module appconfiguration --log debug --color false
displayName: 'Run replace_util.py'
- task: Maven@3
displayName: 'Run tests again.'
inputs:
mavenPomFile: pom.xml
goals: clean verify
options: '-Dgpg.skip -Dmaven.wagon.http.pool=false -Dmaven.javadoc.skip=true -Drevapi.skip=true -pl $(ProjectList)'
5 changes: 4 additions & 1 deletion sdk/spring/azure-spring-cloud-autoconfigure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ Support": this will configure the project to make sure you can integrate easily
For instance, let's assume that you want to use Event Hubs starter, you can add the usual `spring-cloud-starter-azure-eventhubs`
dependency to your project and the Spring Cloud auto-configuration will kick-in:

[//]: # ({x-version-update-start;com.microsoft.azure:spring-cloud-starter-azure-eventhubs;current})
```xml
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>spring-cloud-starter-azure-eventhubs</artifactId>
<version>1.2.8</version>
</dependency>
```
[//]: # ({x-version-update-end})

Note that there is no need to add a `version` as those are managed already by the project.

Expand Down Expand Up @@ -59,7 +62,7 @@ Spring allow all the supported logging systems to set logger levels set in the S

The following example shows potential logging settings in `application.properties`:

```properties
```
logging.level.root=WARN
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR
Expand Down
9 changes: 8 additions & 1 deletion sdk/spring/scripts/replace_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
VERSION_UPDATE_ITEMS = 'version_update_items'

config = {
'appconfiguration': {
'sdk/appconfiguration/azure-spring-cloud-starter-appconfiguration-config-test/pom.xml': {
VERSION_UPDATE_ITEMS: (
VersionUpdateItem('org.springframework.boot:spring-boot-starter-parent', '2.2.9.RELEASE'),
)
}
},
'cosmos': {
'sdk/cosmos/azure-spring-data-cosmos-test/pom.xml': {
VERSION_UPDATE_ITEMS: (
Expand Down Expand Up @@ -83,7 +90,7 @@ def get_args():
parser.add_argument(
'--module',
type = str,
choices = ['spring', 'cosmos'],
choices = ['spring', 'cosmos', 'appconfiguration'],
required = False,
default = 'cosmos',
help = 'Specify the target module.'
Expand Down

0 comments on commit 7a099f0

Please sign in to comment.