Skip to content

Commit

Permalink
test(storage, e2e): start storage emulator during testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehardy committed May 19, 2021
1 parent 95cdec6 commit cf7b157
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/scripts/firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"database": {
"rules": "database.rules"
},
"storage": {
"rules": "storage.rules"
},
"emulators": {
"auth": {
"port": "9099"
Expand All @@ -16,6 +19,9 @@
"firestore": {
"port": "8080"
},
"storage": {
"port": "9199"
},
"ui": {
"enabled": true,
"port": 4000
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/scripts/start-firebase-emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if ! [ -x "$(command -v firebase)" ]; then
exit 1
fi

EMU_START_COMMAND="firebase emulators:start --only auth,database,firestore --project react-native-firebase-testing"
EMU_START_COMMAND="firebase emulators:start --only auth,database,firestore,storage --project react-native-firebase-testing"
#EMU_START_COMMAND="sleep 120"
MAX_RETRIES=3
MAX_CHECKATTEMPTS=60
Expand Down Expand Up @@ -38,4 +38,4 @@ while [ $RETRIES -le $MAX_RETRIES ]; do

done
echo "Firebase Emulator Suite did not come online after $MAX_RETRIES attempts."
exit 1
exit 1
17 changes: 17 additions & 0 deletions .github/workflows/scripts/storage.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{document=**} {
allow read, write: if false;
}

match /writeOnly.txt {
allow read: if false;
allow write: if true;
}

match /react-native-tests/{document=**} {
allow read, write: if true;
}
}
}
2 changes: 1 addition & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"a2a": "^0.2.0",
"babel-plugin-istanbul": "^6.0.0",
"detox": "17.14.6",
"firebase-tools": "^9.10.1",
"firebase-tools": "^9.11.0",
"jest-circus": "^26.6.3",
"jest-environment-node": "^26.6.2",
"jet": "^0.6.6-0",
Expand Down
52 changes: 44 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5979,7 +5979,7 @@ exegesis-express@^2.0.0:
dependencies:
exegesis "^2.0.0"

exegesis@^2.0.0, exegesis@^2.5.6:
exegesis@^2.0.0:
version "2.5.6"
resolved "https://registry.yarnpkg.com/exegesis/-/exegesis-2.5.6.tgz#2a5f198a857b6d820f6bfa0ad41fe29e6fe97446"
integrity sha512-e+YkH/zZTN2njiwrV8tY6tHGDsFu3LyR/YbrqdWvDZaAJ5YGWaBYyd3oX/Y26iGqQc+7jLEKLDTv2UPzjAYL8w==
Expand All @@ -6001,6 +6001,28 @@ exegesis@^2.0.0, exegesis@^2.5.6:
raw-body "^2.3.3"
semver "^7.0.0"

exegesis@^2.5.7:
version "2.5.7"
resolved "https://registry.yarnpkg.com/exegesis/-/exegesis-2.5.7.tgz#232c4b01361bc2bf0d9d4c07549c479e77f2b7a3"
integrity sha512-Y0gEY3hgoLa80aMUm8rhhlIW3/KWo4uqN5hKJqok2GLh3maZjRLRC+p0gj33Jw3upAOKOXeRgScT5rtRoMyxwQ==
dependencies:
"@apidevtools/json-schema-ref-parser" "^9.0.3"
ajv "^6.12.2"
body-parser "^1.18.3"
content-type "^1.0.4"
deep-freeze "0.0.1"
events-listener "^1.1.0"
glob "^7.1.3"
json-ptr "^2.2.0"
json-schema-traverse "^1.0.0"
lodash "^4.17.11"
openapi3-ts "^2.0.1"
promise-breaker "^5.0.0"
pump "^3.0.0"
qs "^6.6.0"
raw-body "^2.3.3"
semver "^7.0.0"

exit-code@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/exit-code/-/exit-code-1.0.2.tgz#ce165811c9f117af6a5f882940b96ae7f9aecc34"
Expand Down Expand Up @@ -6363,10 +6385,10 @@ find-yarn-workspace-root@^2.0.0:
dependencies:
micromatch "^4.0.2"

firebase-tools@^9.10.1:
version "9.10.1"
resolved "https://registry.yarnpkg.com/firebase-tools/-/firebase-tools-9.10.1.tgz#4a0076e9ba77e20a2abe39a8ff547e7e4d1e30d1"
integrity sha512-Tqg88uHkRmMWSLJI99mj6cDNKiohmY2XP2d6+udDThet9RGmAQXJ3SfPNnJ58KDWC1XeLWxdJZua/vwryx0Ofg==
firebase-tools@^9.11.0:
version "9.11.0"
resolved "https://registry.yarnpkg.com/firebase-tools/-/firebase-tools-9.11.0.tgz#a388e8bc66274903b0596551dd9a5956b73ccbb6"
integrity sha512-0yd7VVEeg7Iq1tyosLSEB2uhrCyOqQvYfMOQI2gz4hqct0P9grN2iN9UvuR4he60CU6siaTbO26ZGyEGvRfo8A==
dependencies:
"@google-cloud/pubsub" "^2.7.0"
"@types/archiver" "^5.1.0"
Expand All @@ -6385,7 +6407,7 @@ firebase-tools@^9.10.1:
cross-spawn "^7.0.1"
csv-streamify "^3.0.4"
dotenv "^6.1.0"
exegesis "^2.5.6"
exegesis "^2.5.7"
exegesis-express "^2.0.0"
exit-code "^1.0.2"
express "^4.16.4"
Expand All @@ -6397,7 +6419,7 @@ firebase-tools@^9.10.1:
js-yaml "^3.13.1"
jsonwebtoken "^8.5.1"
leven "^3.1.0"
lodash "^4.17.19"
lodash "^4.17.21"
marked "^0.7.0"
marked-terminal "^3.3.0"
mime "^2.5.2"
Expand Down Expand Up @@ -8578,6 +8600,13 @@ json-ptr@^1.3.1:
dependencies:
tslib "^2.0.0"

json-ptr@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/json-ptr/-/json-ptr-2.2.0.tgz#a4de4ed638cb23ae4cd4b51f8bf972a1c2293f1e"
integrity sha512-w9f6/zhz4kykltXMG7MLJWMajxiPj0q+uzQPR1cggNAE/sXoq/C5vjUb/7QNcC3rJsVIIKy37ALTXy1O+3c8QQ==
dependencies:
tslib "^2.2.0"

json-schema-traverse@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
Expand Down Expand Up @@ -10483,6 +10512,13 @@ openapi3-ts@^1.2.0:
resolved "https://registry.yarnpkg.com/openapi3-ts/-/openapi3-ts-1.4.0.tgz#679d5a24be0efc36f5de4fc2c4b8513663e16f65"
integrity sha512-8DmE2oKayvSkIR3XSZ4+pRliBsx19bSNeIzkTPswY8r4wvjX86bMxsORdqwAwMxE8PefOcSAT2auvi/0TZe9yA==

openapi3-ts@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/openapi3-ts/-/openapi3-ts-2.0.1.tgz#b270aecea09e924f1886bc02a72608fca5a98d85"
integrity sha512-v6X3iwddhi276siej96jHGIqTx3wzVfMTmpGJEQDt7GPI7pI6sywItURLzpEci21SBRpPN/aOWSF5mVfFVNmcg==
dependencies:
yaml "^1.10.0"

opencollective-postinstall@^2.0.1:
version "2.0.3"
resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz#7a0fff978f6dbfa4d006238fbac98ed4198c3259"
Expand Down Expand Up @@ -13255,7 +13291,7 @@ tslib@^1.8.1, tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==

tslib@^2.0.0, tslib@^2.0.1, tslib@^2.1.0:
tslib@^2.0.0, tslib@^2.0.1, tslib@^2.1.0, tslib@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c"
integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==
Expand Down

0 comments on commit cf7b157

Please sign in to comment.