Skip to content

Commit

Permalink
update smoke tests, include ability to fetch latest version from dev …
Browse files Browse the repository at this point in the history
…feed (Azure#7079)

* update smoke tests
* fix a lot, except EventHubs 
* version poc
* add dev feed location to smoke tests' pom.xml
* add package update steps
* scope version updating to  groupId
* move smoke tests to common, supply baseline known working verisons to the pom file
* remove versionBackup file
* validate date entries in dev.yyyymmdd to ensure no date mismatch after resolving latest packages from the dev feed
this helps ensure that latest packages have published before running smoke tests

* add validate_version_dates.py into smoke-test.yml
* expand testing matrix
* exclude smoke tests from doc validation
* fix cosmosdb for 4.0.0-beta.1
* remove compiler source and target configuration from smoke test pom
* add continueOnError to smoke test pipeline date consistency validation
* extract get_xml_root from smoke test validate_version_dates.py
* add dependency shuffling
* no more .decode()
* better variable placement
* for some reason ShuffleDependencies is being treated as quoted, maybe this can be fixed with explicit quotes

* include azure-cosmos now that a later-sorting version has been released
* remove extra print(xml)
* add profiles so we actually build against baseline and LTS
* update cosmosdb implementation
* upgrade cosmos version
* increase timeout
* review feedback
  * remove dependency shuffling
  * use external dependency tracking
  * smoke test version scheme matches policy
* revert dependency version changes accidentally checked in after running versions:use-latest-versions
* fix Cosmos DB smoke test to use new interface
* disable Cosmos DB tests until the Cosmos library ships from master
* do not depend on cosmos and comment out cosmos test code with notes that we will re-enable once we're shipping packages reliably from master

* add version for maven-compiler-plugin and external dependency version update tag
* set version update tags in the remaining pom file locations
  • Loading branch information
danieljurek authored Feb 20, 2020
1 parent 5572420 commit a943647
Show file tree
Hide file tree
Showing 14 changed files with 632 additions and 348 deletions.
File renamed without changes.
145 changes: 145 additions & 0 deletions common/smoke-tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<?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>
<groupId>com.azure</groupId>
<artifactId>smoke-test</artifactId>
<version>1.0.0-beta.1</version>
<name>smoke-test</name>
<url>https://github.com/Azure/azure-sdk-for-java</url>




<repositories>
<repository>
<id>azure-sdk-dev</id>
<url>https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-java/maven/v1</url>
</repository>
</repositories>


<profiles>
<!--
By default we build against our baseline, Java 8, but we also want to ensure compatibility
against the latest Java LTS release, currently Java 11. We therefore have two profiles:
* The default 'java8', which will perform a build using Java 8 as its target.
* The non-default 'java-lts' profile, which will build against the current LTS release.
-->
<profile>
<id>java8</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>!java-lts</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-compiler-plugin;external_dependency} -->
<configuration>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<compilerArgument>-Xlint:all</compilerArgument>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>java-lts</id>
<activation>
<property>
<name>java-lts</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-compiler-plugin;external_dependency} -->
<configuration>
<source>11</source>
<target>11</target>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<compilerArgument>-Xlint:all</compilerArgument>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<dependencies>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13-beta-3</version> <!-- {x-version-update;junit:junit;external_dependency} -->
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.2.0</version>
</dependency>

<!--
Cosmos is disabled until we are shipping from master
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-cosmos</artifactId>
<version>4.0.0-preview.2</version>
</dependency>
-->

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.0.3</version>
</dependency>

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-secrets</artifactId>
<version>4.1.0</version>
</dependency>

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-messaging-eventhubs</artifactId>
<version>5.0.1</version>
</dependency>

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-blob</artifactId>
<version>12.3.0</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.25</version> <!-- {x-version-update;org.slf4j:slf4j-simple;external_dependency} -->
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-compiler-plugin;external_dependency} -->
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
public class App {
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);

public static void main(String[] args) throws IllegalArgumentException, IOException {
public static void main(String[] args) throws IllegalArgumentException, IOException, Exception {
LOGGER.info("================================");
LOGGER.info(" AZURE SDK SMOKE TEST");
LOGGER.info("================================");

KeyVaultSecrets.main(null);
StorageBlob.main(null);
EventHubs.main(null);
CosmosDB.main(null);
// Disabling until cosmos ships from master
// CosmosDB.main(null);

}
}
202 changes: 202 additions & 0 deletions common/smoke-tests/src/main/java/com/azure/CosmosDB.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
// Disable tests until Cosmos ships from master

// // Copyright (c) Microsoft Corporation. All rights reserved.
// // Licensed under the MIT License.
// package com.azure;

// import com.azure.cosmos.CosmosAsyncClient;
// import com.azure.cosmos.CosmosAsyncContainer;
// import com.azure.cosmos.CosmosAsyncDatabase;
// import com.azure.cosmos.CosmosAsyncItemResponse;
// import com.azure.cosmos.CosmosClientException;
// import com.azure.cosmos.CosmosContainerProperties;
// import com.azure.cosmos.CosmosContinuablePagedFlux;
// import com.azure.cosmos.implementation.CosmosItemProperties;
// import com.azure.cosmos.FeedOptions;
// import com.azure.cosmos.FeedResponse;
// import com.azure.cosmos.PartitionKey;
// import reactor.core.publisher.Mono;
// import reactor.core.scheduler.Schedulers;


// import org.slf4j.Logger;
// import org.slf4j.LoggerFactory;

// import java.util.UUID;

// public class CosmosDB {

// private static final String DATABASE_NAME = "test_db" + UUID.randomUUID();
// private static final String CONTAINER_NAME = "test_container";
// private static CosmosAsyncClient client;
// private static CosmosAsyncDatabase database;
// private static CosmosAsyncContainer container;

// private static final String AZURE_COSMOS_ENDPOINT = System.getenv("AZURE_COSMOS_ENDPOINT");
// private static final String AZURE_COSMOS_KEY= System.getenv("AZURE_COSMOS_KEY");
// private static final Logger LOGGER = LoggerFactory.getLogger(CosmosDB.class);

// public static void main(String[] args) {
// // Get client
// client = CosmosAsyncClient.cosmosClientBuilder()
// .setEndpoint(AZURE_COSMOS_ENDPOINT)
// .setKey(AZURE_COSMOS_KEY)
// .buildAsyncClient();

// //CREATE a database and a container
// createDbAndContainerBlocking();

// //Get a proxy reference to container
// container = client.getDatabase(DATABASE_NAME).getContainer(CONTAINER_NAME);

// CosmosAsyncContainer container = client.getDatabase(DATABASE_NAME).getContainer(CONTAINER_NAME);
// TestObject testObject = new TestObject("item_new_id_1", "test", "test description", "US");
// TestObject testObject2 = new TestObject("item_new_id_2", "test2", "test description2", "CA");

// //CREATE an Item async

// Mono<CosmosAsyncItemResponse<TestObject>> itemResponseMono = container.createItem(testObject);
// //CREATE another Item async
// Mono<CosmosAsyncItemResponse<TestObject>> itemResponseMono1 = container.createItem(testObject2);

// //Wait for completion
// itemResponseMono.doOnError(throwable -> LOGGER.info("CREATE item 1", throwable))
// .mergeWith(itemResponseMono1)
// .doOnComplete(() -> LOGGER.info("Items created"))
// .publishOn(Schedulers.elastic())
// .blockLast();


// createAndReplaceItem();
// queryItems();
// queryWithContinuationToken();

// deleteDatabaseBlocking();

// //Close client
// client.close();
// LOGGER.info("Completed");
// }

// private static void createAndReplaceItem() {
// TestObject replaceObject = new TestObject("item_new_id_3", "test3", "test description3", "JP");
// TestObject properties = null;
// //CREATE item sync
// properties = container.createItem(replaceObject)
// .publishOn(Schedulers.elastic())
// .block()
// .getResource();

// if (properties != null) {
// replaceObject.setName("new name test3");

// //REPLACE the item and wait for completion
// container.replaceItem(replaceObject,
// properties.getId(),
// new PartitionKey(replaceObject.getCountry()))
// .block();
// }
// }

// private static void createDbAndContainerBlocking() {
// client.createDatabaseIfNotExists(DATABASE_NAME)
// .doOnSuccess(cosmosDatabaseResponse -> LOGGER.info("Database: " + cosmosDatabaseResponse.getDatabase().getId()))
// .flatMap(dbResponse -> dbResponse.getDatabase()
// .createContainerIfNotExists(new CosmosContainerProperties(CONTAINER_NAME,
// "/country")))
// .doOnSuccess(cosmosContainerResponse -> LOGGER.info("Container: " + cosmosContainerResponse.getContainer().getId()))
// .publishOn(Schedulers.elastic())
// .block();
// }

// private static void deleteDatabaseBlocking() {
// LOGGER.info("Deleting database...");
// client.getDatabase(DATABASE_NAME).delete().block();
// }

// private static void queryItems() {
// LOGGER.info("+ Querying the collection ");
// String query = "SELECT * from root";
// FeedOptions options = new FeedOptions();
// options.setMaxDegreeOfParallelism(2);
// CosmosContinuablePagedFlux<TestObject> queryFlux = container.queryItems(query, options, TestObject.class);

// queryFlux.byPage()
// .publishOn(Schedulers.elastic())
// .toIterable()
// .forEach(cosmosItemFeedResponse -> {
// cosmosItemFeedResponse.getResults().forEach(item -> {
// LOGGER.info(" - Got Item: {}", item.getId());
// });
// });
// }

// private static void queryWithContinuationToken() {
// LOGGER.info("+ Query with paging using continuation token");
// String query = "SELECT * from root r ";
// FeedOptions options = new FeedOptions();
// options.populateQueryMetrics(true);
// options.maxItemCount(1);
// String continuation = null;
// do {
// options.requestContinuation(continuation);
// CosmosContinuablePagedFlux<TestObject> queryFlux = container.queryItems(query, options, TestObject.class);
// FeedResponse<TestObject> page = queryFlux.byPage().blockFirst();
// assert page != null;
// page.getResults().forEach(item -> {
// LOGGER.info(" - Got Item: {}", item.getId());
// });
// continuation = page.getContinuationToken();
// } while (continuation != null);

// }

// static class TestObject {
// String id;
// String name;
// String description;
// String country;

// public TestObject() {
// }

// public TestObject(String id, String name, String description, String country) {
// this.id = id;
// this.name = name;
// this.description = description;
// this.country = country;
// }

// public String getId() {
// return id;
// }

// public void setId(String id) {
// this.id = id;
// }

// public String getCountry() {
// return country;
// }

// public void setCountry(String country) {
// this.country = country;
// }

// public String getName() {
// return name;
// }

// public void setName(String name) {
// this.name = name;
// }

// public String getDescription() {
// return description;
// }

// public void setDescription(String description) {
// this.description = description;
// }
// }
// }
Loading

0 comments on commit a943647

Please sign in to comment.