Skip to content

Commit fcd8fe3

Browse files
authored
Run smoke tests using GitHub Actions (#1496) (#1518)
1 parent d2537eb commit fcd8fe3

File tree

98 files changed

+240
-720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+240
-720
lines changed

.github/workflows/pr.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: PR build
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
setup-smoke-test-matrix:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
matrix: ${{ steps.set-matrix.outputs.matrix }}
14+
steps:
15+
- name: Check out repository
16+
uses: actions/checkout@v2
17+
- name: Set up JDK 8 for running Gradle
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: 8
21+
- id: set-matrix
22+
# "grep -v skipWinNative" is used to skip the warning message "Skipping build of :etw:native because skipWinNative=true"
23+
run: echo "::set-output name=matrix::{\"module\":[\"$(./gradlew -q :test:smoke:testApps:listTestApps | grep -v skipWinNative | xargs echo | sed 's/ /","/g')\"]}"
24+
25+
smoke-test:
26+
needs: setup-smoke-test-matrix
27+
runs-on: ubuntu-latest
28+
strategy:
29+
matrix: ${{fromJson(needs.setup-smoke-test-matrix.outputs.matrix)}}
30+
fail-fast: false
31+
steps:
32+
- uses: actions/checkout@v2
33+
- id: setup-test-java
34+
name: Set up JDK 8 for running Gradle
35+
uses: actions/setup-java@v1
36+
with:
37+
java-version: 8
38+
- name: Test
39+
run: ./gradlew ${{ matrix.module }}:smokeTest --no-daemon
40+
41+
accept-pr:
42+
needs: smoke-test
43+
runs-on: ubuntu-latest
44+
if: always()
45+
steps:
46+
# run this action to get workflow conclusion
47+
# You can get conclusion by env (env.WORKFLOW_CONCLUSION)
48+
- uses: technote-space/workflow-conclusion-action@v1
49+
- name: Fail build
50+
if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure
51+
run: exit 1

settings.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ include ':test:smoke'
5252
include ':test:smoke:appServers'
5353
include ':test:smoke:appServers:Tomcat.7'
5454
include ':test:smoke:appServers:Tomcat.8.5'
55-
include ':test:smoke:appServers:JBossEAP.7'
56-
include ':test:smoke:appServers:JBossEAP.6'
55+
include ':test:smoke:appServers:Wildfly.11'
5756
include ':test:smoke:appServers:Jetty.9'
5857
include ':test:smoke:testApps'
5958

test/fakeIngestion/standalone/src/main/java/com/microsoft/applicationinsights/test/fakeingestion/MockedAppInsightsIngestionServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import java.util.concurrent.TimeoutException;
1919

2020
public class MockedAppInsightsIngestionServer {
21-
public static final int DEFAULT_PORT = 60606;
21+
public static final int DEFAULT_PORT = 6060;
2222

2323
private final MockedAppInsightsIngestionServlet servlet;
2424
private final Server server;

test/smoke/README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
# ApplicationInsights-Java Smoke Tests
22

33
## Prerequisites
4-
* Windows 10
5-
* [Docker for Windows][windock]
6-
* Set environment variables:
7-
* **DOCKER_EXE** This should point to docker.exe, e.g. C:\Program Files\Docker\Docker\resources\bin\docker.exe
8-
* **DOCKER_CLI_EXE** This should point to DockerCli.exe, e.g. C:\Program Files\Docker\Docker\DockerCli.exe
9-
4+
* Docker
105

116
## Overview
127
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.
@@ -164,10 +159,9 @@ Currently, the only **target_os** supported is `linux`. There are plans to suppo
164159

165160
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`**_
166161

167-
5. Inside the `resources/linux` directory, create two scripts specific to this application server:
162+
5. Inside the `resources/linux` directory, create one script specific to this application server:
168163
* `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.
169164
`deploy.sh` will be run after the appserver has started and after the test app WAR is copied into the container.
170-
* `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.
171165
6. Add an `inlucde` statement to `settings.gradle` at the root of the repository. For example:
172166
```gradle
173167
include ':test:smoke:appServers:MyAppServer'

test/smoke/appServers/JBossEAP.6/README.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

test/smoke/appServers/JBossEAP.6/build.gradle

Lines changed: 0 additions & 6 deletions
This file was deleted.

test/smoke/appServers/JBossEAP.6/jbosseap6.linux.partial.dockerfile

Lines changed: 0 additions & 33 deletions
This file was deleted.

test/smoke/appServers/JBossEAP.6/jre.excludes.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/smoke/appServers/JBossEAP.6/resources/linux/stopServer.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

test/smoke/appServers/JBossEAP.6/resources/linux/tailLastLog.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)