Skip to content

Commit 4b4e1ca

Browse files
committed
Separating unit tests and integration tests into separate steps
1 parent 012604e commit 4b4e1ca

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

.github/scripts/package_artifacts.sh renamed to .github/scripts/run_integration_tests.sh

+1-11
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,5 @@ gpg --quiet --batch --yes --decrypt --passphrase="${FIREBASE_SERVICE_ACCT_KEY}"
2222

2323
echo "${FIREBASE_API_KEY}" > integration_apikey.txt
2424

25-
# Does the following:
26-
# 1. Runs the Checkstyle plugin (validate phase)
27-
# 2. Compiles the source (compile phase)
28-
# 3. Runs the unit tests (test phase)
29-
# 4. Packages the artifacts - src, bin, javadocs (package phase)
30-
# 5. Runs the integration tests (verify phase)
31-
mvn -B clean verify
25+
mvn -B verify -Dcheckstyle.skip -DskipUTs
3226

33-
# Maven target directory can consist of many files. Just copy the jar artifacts
34-
# into a new directory for upload.
35-
mkdir -p dist
36-
cp target/*.jar dist/

.github/workflows/release.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ jobs:
5050
java-version: 1.7
5151

5252
- name: Compile, test and package
53-
run: ./.github/scripts/package_artifacts.sh
54-
env:
55-
FIREBASE_SERVICE_ACCT_KEY: ${{ secrets.FIREBASE_SERVICE_ACCT_KEY }}
56-
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
53+
run: |
54+
mvn -B clean package
55+
mkdir -p dist/
56+
cp target/*.jar dist/
5757
5858
# Attach the packaged artifacts to the workflow output. These can be manually
5959
# downloaded for later inspection if necessary.
@@ -63,6 +63,12 @@ jobs:
6363
name: dist
6464
path: dist
6565

66+
- name: Run integration tests
67+
run: ./.github/scripts/run_integration_tests.sh
68+
env:
69+
FIREBASE_SERVICE_ACCT_KEY: ${{ secrets.FIREBASE_SERVICE_ACCT_KEY }}
70+
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
71+
6672
publish_release:
6773
needs: stage_release
6874

src/test/java/com/google/firebase/messaging/FirebaseMessagingIT.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,22 @@ public void testSendFiveHundred() throws Exception {
122122

123123
BatchResponse response = FirebaseMessaging.getInstance().sendAll(messages, true);
124124

125+
// This test appears to fail intermittently. Adjusting the structure of the test to help
126+
// debug the issue.
125127
assertEquals(500, response.getResponses().size());
126-
assertEquals(500, response.getSuccessCount());
127-
assertEquals(0, response.getFailureCount());
128128
for (SendResponse sendResponse : response.getResponses()) {
129129
if (!sendResponse.isSuccessful()) {
130130
sendResponse.getException().printStackTrace();
131+
continue;
131132
}
132-
assertTrue(sendResponse.isSuccessful());
133+
133134
String id = sendResponse.getMessageId();
134135
assertTrue(id != null && id.matches("^projects/.*/messages/.*$"));
135136
assertNull(sendResponse.getException());
136137
}
138+
139+
assertEquals(500, response.getSuccessCount());
140+
assertEquals(0, response.getFailureCount());
137141
}
138142

139143
@Test

0 commit comments

Comments
 (0)