Skip to content

Commit 6770e90

Browse files
Enable Integration Tests in Git
1 parent 3cb987e commit 6770e90

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

.github/workflows/spm.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ jobs:
3030
env:
3131
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
3232
FIREBASE_MAIN: 1
33-
DISABLE_INTEGRATION_TESTS: 1
3433
steps:
3534
- uses: actions/checkout@v4
3635
- name: Generate Swift Package.resolved
@@ -62,7 +61,6 @@ jobs:
6261
env:
6362
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
6463
FIREBASE_MAIN: 1
65-
DISABLE_INTEGRATION_TESTS: 1
6664
steps:
6765
- uses: actions/checkout@v4
6866
- uses: actions/cache/restore@v4
@@ -75,3 +73,5 @@ jobs:
7573
run: ./setup-scripts.sh
7674
- name: Unit Tests
7775
run: scripts/third_party/travis/retry.sh scripts/build.sh FirebaseDataConnect ${{ matrix.target }} spm
76+
- name: Integration Test Server
77+
run: Tests/Integration/Emulator/start-emulator.sh synchronous
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2018 Google
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# Sets up Firebase Data Connect emulator and starts it to run
18+
# integration tests.
19+
20+
set -e
21+
22+
# Get the absolute path to the directory containing this script.
23+
SCRIPT_DIR="$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)"
24+
TEMP_DIR="$(mktemp -d -t firebase-data-connect)"
25+
echo "Starting Firebase Data Connect emulator in ${TEMP_DIR}"
26+
cd "${TEMP_DIR}"
27+
28+
EMULATOR_VERSION="1.8.3"
29+
EMULATOR_FILENAME="dataconnect-emulator-macos-v${EMULATOR_VERSION}"
30+
EMULATOR_URL="https://storage.googleapis.com/firemat-preview-drop/emulator/${EMULATOR_FILENAME}"
31+
echo "Downloading emulator from ${EMULATOR_URL}"
32+
33+
curl -o "${EMULATOR_FILENAME}" "${EMULATOR_URL}"
34+
35+
chmod 755 "${EMULATOR_FILENAME}"
36+
37+
./${EMULATOR_FILENAME} --logtostderr dev --listen="127.0.0.1:3628"

Tests/Integration/IntegrationTestBase.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ class IntegrationTestBase: XCTestCase {
3737
)
3838

3939
override class func setUp() {
40-
FirebaseApp.configure(options: options)
41-
defaultApp = FirebaseApp.app()
40+
if defaultApp == nil {
41+
FirebaseApp.configure(options: options)
42+
defaultApp = FirebaseApp.app()
43+
}
4244
DataConnect.kitchenSinkConnector.useEmulator(port: 3628)
4345
}
4446
}

0 commit comments

Comments
 (0)