Skip to content

Commit 6c13cf9

Browse files
authored
[Perf] Add example perf test for template (Azure#18740)
- Add "common/perf-test-core/" to template pipeline triggers
1 parent ff9aff1 commit 6c13cf9

File tree

10 files changed

+172
-3
lines changed

10 files changed

+172
-3
lines changed

eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,12 +448,12 @@ the main ServiceBusClientBuilder. -->
448448
files="com.azure.cosmos.ClientSideRequestStatistics"/> <!-- Need OperatingSystemMXBean from sun to obtain cpu info -->
449449

450450
<!-- perf-test files are not public API, so they don't need to fulfill all requirements. -->
451-
<suppress checks="Javadoc" files=".*[/\\]azure-storage-perf|azure-search-perf|azure-identity-perf[/\\].*\.java"/>
451+
<suppress checks="Javadoc" files=".*[/\\]azure-storage-perf|azure-search-perf|azure-identity-perf|azure-template-perf[/\\].*\.java"/>
452452
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFields"
453453
files=".*[/\\]azure-identity-perf|azure-search-perf[/\\].*\.java"/>
454454
<suppress checks="GoodLogging" files=".*[/\\]azure-storage-perf|azure-search-perf|perf-test-core[/\\].*\.java"/>
455455
<suppress checks="com.azure.tools.checkstyle.checks.ThrowFromClientLoggerCheck"
456-
files=".*[/\\]azure-identity-perf|azure-search-perf|azure-storage-perf|perf-test-core[/\\].*\.java"/>
456+
files=".*[/\\]azure-identity-perf|azure-search-perf|azure-storage-perf|perf-test-core|azure-template-perf[/\\].*\.java"/>
457457
<!-- Azure Search test models -->
458458
<suppress checks="StaticVariableName|VisibilityModifier"
459459
files="com.azure.search.perf.*.java|com.azure.messaging.servicebus.perf.*.java"/>

eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,11 @@
790790
<Bug pattern="BC_UNCONFIRMED_CAST, DM_EXIT, RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
791791
</Match>
792792

793+
<Match>
794+
<Package name="com.azure.sdk.template.perf"/>
795+
<Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/>
796+
</Match>
797+
793798
<!-- StringUtils.strip can return NULL so the NULL check is required -->
794799
<Match>
795800
<Class name="com.azure.cosmos.implementation.PathsHelper"/>

eng/versioning/version_client.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ com.azure:azure-storage-file-datalake;12.4.0;12.5.0-beta.1
102102
com.azure:azure-storage-internal-avro;12.0.2;12.1.0-beta.1
103103
com.azure:azure-storage-perf;1.0.0-beta.1;1.0.0-beta.1
104104
com.azure:azure-storage-queue;12.8.0;12.9.0-beta.1
105+
com.azure:azure-template-perf;1.0.0-beta.1;1.0.0-beta.1
105106
com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1
106107
com.azure.spring:azure-spring-cloud-appconfiguration-config-web;1.2.8-beta.1;1.2.8-beta.1
107108
com.azure.spring:azure-spring-cloud-appconfiguration-config;1.2.8-beta.1;1.2.8-beta.1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Release History
2+
3+
## 1.0.0-beta.1 (Unreleased)
4+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Azure Template Performance test client library for Java
2+
3+
Represents Performance tests for Azure Template SDK for Java.
4+
5+
## Getting started
6+
7+
### Prerequisites
8+
9+
- Java Development Kit (JDK) with version 8 or above
10+
11+
### Adding the package to your product
12+
13+
14+
## Key concepts
15+
16+
17+
## Examples
18+
19+
## Troubleshooting
20+
21+
## Next steps
22+
23+
## Contributing
24+
25+
For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md).
26+
27+
1. Fork it
28+
1. Create your feature branch (`git checkout -b my-new-feature`)
29+
1. Commit your changes (`git commit -am 'Add some feature'`)
30+
1. Push to the branch (`git push origin my-new-feature`)
31+
1. Create new Pull Request
32+
33+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%template%2Fperf-test-core%2FREADME.png)
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0"
4+
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">
5+
6+
<parent>
7+
<groupId>com.azure</groupId>
8+
<artifactId>azure-client-sdk-parent</artifactId>
9+
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
10+
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
11+
</parent>
12+
13+
<modelVersion>4.0.0</modelVersion>
14+
15+
<groupId>com.azure</groupId>
16+
<artifactId>azure-template-perf</artifactId>
17+
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-template-perf;current} -->
18+
<packaging>jar</packaging>
19+
20+
<properties>
21+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
22+
<maven.compiler.source>1.8</maven.compiler.source>
23+
<maven.compiler.target>1.8</maven.compiler.target>
24+
</properties>
25+
26+
<dependencies>
27+
<dependency>
28+
<groupId>com.azure</groupId>
29+
<artifactId>azure-sdk-template</artifactId>
30+
<version>1.2.1-beta.16</version> <!-- {x-version-update;com.azure:azure-sdk-template;current} -->
31+
</dependency>
32+
<dependency>
33+
<groupId>com.azure</groupId>
34+
<artifactId>perf-test-core</artifactId>
35+
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:perf-test-core;current} -->
36+
</dependency>
37+
</dependencies>
38+
39+
<build>
40+
<plugins>
41+
<plugin>
42+
<groupId>org.apache.maven.plugins</groupId>
43+
<artifactId>maven-assembly-plugin</artifactId>
44+
<version>3.2.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-assembly-plugin;external_dependency} -->
45+
<executions>
46+
<execution>
47+
<phase>package</phase>
48+
<goals>
49+
<goal>single</goal>
50+
</goals>
51+
<configuration>
52+
<archive>
53+
<manifest>
54+
<mainClass>
55+
com.azure.sdk.template.perf.App
56+
</mainClass>
57+
</manifest>
58+
</archive>
59+
<descriptorRefs>
60+
<descriptorRef>jar-with-dependencies</descriptorRef>
61+
</descriptorRefs>
62+
</configuration>
63+
</execution>
64+
</executions>
65+
</plugin>
66+
</plugins>
67+
</build>
68+
</project>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
package com.azure.sdk.template.perf;
5+
6+
import com.azure.perf.test.core.PerfStressProgram;
7+
8+
/**
9+
* Runs the Template performance test.
10+
*
11+
* <p>To run from command line. Package the project into a jar with dependencies via mvn clean package.
12+
* Then run the program via java -jar 'compiled-jar-with-dependencies-path' </p>
13+
*
14+
* <p> To run from IDE, set all the required environment variables in IntelliJ via Run -&gt; EditConfigurations
15+
* section.
16+
* Then run the App's main method via IDE.</p>
17+
*/
18+
public class App {
19+
public static void main(String[] args) {
20+
PerfStressProgram.run(new Class<?>[]{
21+
GetMessageTest.class,
22+
}, args);
23+
}
24+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
package com.azure.sdk.template.perf;
5+
6+
import com.azure.perf.test.core.PerfStressTest;
7+
import com.azure.perf.test.core.PerfStressOptions;
8+
import com.azure.sdk.template.Hello;
9+
import reactor.core.publisher.Mono;
10+
11+
public class GetMessageTest extends PerfStressTest<PerfStressOptions> {
12+
private final Hello hello;
13+
14+
public GetMessageTest(PerfStressOptions options) {
15+
super(options);
16+
17+
hello = new Hello();
18+
}
19+
20+
@Override
21+
public void run() {
22+
hello.getMessage();
23+
}
24+
25+
@Override
26+
public Mono<Void> runAsync() {
27+
throw new UnsupportedOperationException();
28+
}
29+
}

sdk/template/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ trigger:
88
- release/*
99
paths:
1010
include:
11+
- common/perf-test-core/
1112
- sdk/template/
1213

1314
pr:
@@ -19,6 +20,7 @@ pr:
1920
- release/*
2021
paths:
2122
include:
23+
- common/perf-test-core/
2224
- sdk/template/
2325

2426
extends:
@@ -29,4 +31,6 @@ extends:
2931
- name: azure-sdk-template
3032
groupId: com.azure
3133
safeName: azuresdktemplate
32-
34+
AdditionalModules:
35+
- name: azure-template-perf
36+
groupId: com.azure

sdk/template/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
</activation>
5252
<modules>
5353
<module>azure-sdk-template</module>
54+
<module>azure-template-perf</module>
5455
</modules>
5556
</profile>
5657
</profiles>

0 commit comments

Comments
 (0)