Skip to content

Commit

Permalink
Run smoke tests using GitHub Actions (#1496) (#1518)
Browse files Browse the repository at this point in the history
  • Loading branch information
trask authored Mar 1, 2021
1 parent d2537eb commit fcd8fe3
Show file tree
Hide file tree
Showing 98 changed files with 240 additions and 720 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: PR build

on:
pull_request:
push:
branches:
- main

jobs:
setup-smoke-test-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up JDK 8 for running Gradle
uses: actions/setup-java@v1
with:
java-version: 8
- id: set-matrix
# "grep -v skipWinNative" is used to skip the warning message "Skipping build of :etw:native because skipWinNative=true"
run: echo "::set-output name=matrix::{\"module\":[\"$(./gradlew -q :test:smoke:testApps:listTestApps | grep -v skipWinNative | xargs echo | sed 's/ /","/g')\"]}"

smoke-test:
needs: setup-smoke-test-matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.setup-smoke-test-matrix.outputs.matrix)}}
fail-fast: false
steps:
- uses: actions/checkout@v2
- id: setup-test-java
name: Set up JDK 8 for running Gradle
uses: actions/setup-java@v1
with:
java-version: 8
- name: Test
run: ./gradlew ${{ matrix.module }}:smokeTest --no-daemon

accept-pr:
needs: smoke-test
runs-on: ubuntu-latest
if: always()
steps:
# run this action to get workflow conclusion
# You can get conclusion by env (env.WORKFLOW_CONCLUSION)
- uses: technote-space/workflow-conclusion-action@v1
- name: Fail build
if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure
run: exit 1
3 changes: 1 addition & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ include ':test:smoke'
include ':test:smoke:appServers'
include ':test:smoke:appServers:Tomcat.7'
include ':test:smoke:appServers:Tomcat.8.5'
include ':test:smoke:appServers:JBossEAP.7'
include ':test:smoke:appServers:JBossEAP.6'
include ':test:smoke:appServers:Wildfly.11'
include ':test:smoke:appServers:Jetty.9'
include ':test:smoke:testApps'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.concurrent.TimeoutException;

public class MockedAppInsightsIngestionServer {
public static final int DEFAULT_PORT = 60606;
public static final int DEFAULT_PORT = 6060;

private final MockedAppInsightsIngestionServlet servlet;
private final Server server;
Expand Down
10 changes: 2 additions & 8 deletions test/smoke/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# ApplicationInsights-Java Smoke Tests

## Prerequisites
* Windows 10
* [Docker for Windows][windock]
* Set environment variables:
* **DOCKER_EXE** This should point to docker.exe, e.g. C:\Program Files\Docker\Docker\resources\bin\docker.exe
* **DOCKER_CLI_EXE** This should point to DockerCli.exe, e.g. C:\Program Files\Docker\Docker\DockerCli.exe

* Docker

## Overview
The goal for the smoke tests is to exercise and validate the ApplicationInsights Java SDK in each supported environment. The test matrix has dimensions for OS, Application Servers and JREs. A custom task in the gradle build script is used for generating the application environments (using Docker), building the test applications and running the tests against the applications in each environment.
Expand Down Expand Up @@ -164,10 +159,9 @@ Currently, the only **target_os** supported is `linux`. There are plans to suppo

4. Inside the appserver subdirectory, create a directory named `resources` with a subdirectory for each target OS (again, currently only `linux` is supported). For example, `/test/smoke/appServers`_`MyAppServer.1`_`/`_**`resources/linux`**_

5. Inside the `resources/linux` directory, create two scripts specific to this application server:
5. Inside the `resources/linux` directory, create one script specific to this application server:
* `deploy.sh` - This should take one argument, the absolute path to the test application WAR file. The script will use the application server's mechanism to deploy the WAR file into the server. This can be using the appserver's management API or copying the WAR into a scanned directory; it depends on the application server spec.
`deploy.sh` will be run after the appserver has started and after the test app WAR is copied into the container.
* `tailLastLog.sh` - This takes one optional argument, number of lines to tail. This will be run when a test failed and the goal is to provide any additional diagnostics for addressing the test failure. When run, it should print the given/default number of lines from the tail of the application server's logs. This should include the application server log file which captures the logs from the test application. Logs from deployment should also be included. This could be from one or more files depending on the application server spec. If more than one file is tailed, include a filename header before dumping the log file.
6. Add an `inlucde` statement to `settings.gradle` at the root of the repository. For example:
```gradle
include ':test:smoke:appServers:MyAppServer'
Expand Down
7 changes: 0 additions & 7 deletions test/smoke/appServers/JBossEAP.6/README.md

This file was deleted.

6 changes: 0 additions & 6 deletions test/smoke/appServers/JBossEAP.6/build.gradle

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions test/smoke/appServers/JBossEAP.6/jre.excludes.txt

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions test/smoke/appServers/JBossEAP.6/resources/linux/tailLastLog.sh

This file was deleted.

21 changes: 0 additions & 21 deletions test/smoke/appServers/JBossEAP.6/resources/linux/undeploy.sh

This file was deleted.

7 changes: 0 additions & 7 deletions test/smoke/appServers/JBossEAP.7/README.md

This file was deleted.

6 changes: 0 additions & 6 deletions test/smoke/appServers/JBossEAP.7/build.gradle

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion test/smoke/appServers/JBossEAP.7/jre.excludes.txt

This file was deleted.

21 changes: 0 additions & 21 deletions test/smoke/appServers/JBossEAP.7/resources/linux/deploy.sh

This file was deleted.

15 changes: 0 additions & 15 deletions test/smoke/appServers/JBossEAP.7/resources/linux/startServer.sh

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions test/smoke/appServers/JBossEAP.7/resources/linux/tailLastLog.sh

This file was deleted.

21 changes: 0 additions & 21 deletions test/smoke/appServers/JBossEAP.7/resources/linux/undeploy.sh

This file was deleted.

41 changes: 0 additions & 41 deletions test/smoke/appServers/JBossEAP.gradle

This file was deleted.

3 changes: 1 addition & 2 deletions test/smoke/appServers/Jetty.9/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

ext {
appServerShortName = 'jetty9'
}
}
Loading

0 comments on commit fcd8fe3

Please sign in to comment.