Skip to content

Cache emulator between runs #3956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2020
Merged

Cache emulator between runs #3956

merged 1 commit into from
Oct 29, 2020

Conversation

samtstern
Copy link
Contributor

@samtstern samtstern commented Oct 16, 2020

Discussion

When running unit tests locally the emulator is downloaded every time. This is 30-60MB depending on the service and on my slow home WiFi this makes test startup much slower than it needs to be.

Testing

Here are the database unit tests, run twice.

First run:

$ yarn test:emulator
yarn run v1.22.4
$ ts-node --compiler-options='{"module":"commonjs"}' ../../scripts/emulator-testing/database-test-runner.ts
Created temporary directory at [/var/folders/xl/6lkrzp7j07581mw8_4dlt3b000643s/T/tmp-88560-ch7akdXEY5Iy].
Downloading emulator from [https://storage.googleapis.com/firebase-preview-drop/emulator/firebase-database-emulator-v4.4.1.jar] ...
Saved emulator binary file to [/var/folders/xl/6lkrzp7j07581mw8_4dlt3b000643s/T/tmp-88560-ch7akdXEY5Iy/firebase-database-emulator-v4.4.1.jar].
Changed emulator file permissions to 'rwxr-xr-x'.
Cached emulator at /Users/samstern/.cache/firebase-js-sdk/firebase-database-emulator-v4.4.1.jar
Waiting for emulator to start up ...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/private/var/folders/xl/6lkrzp7j07581mw8_4dlt3b000643s/T/tmp-88560-ch7akdXEY5Iy/firebase-database-emulator-v4.4.1.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Ping emulator at [http://localhost:8088] ...
13:02:35.700 [NamespaceSystem-akka.actor.default-dispatcher-5] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
Ping emulator at [http://localhost:8088] ...
13:02:35.892 [main] INFO com.firebase.server.forge.App$ - Listening at localhost:8088
Ping emulator at [http://localhost:8088] ...
Emulator has started up after 3.019s!

Second run:

$ yarn test:emulator
yarn run v1.22.4
$ ts-node --compiler-options='{"module":"commonjs"}' ../../scripts/emulator-testing/database-test-runner.ts
Emulator found in cache: /Users/samstern/.cache/firebase-js-sdk/firebase-database-emulator-v4.4.1.jar
Waiting for emulator to start up ...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/Users/samstern/.cache/firebase-js-sdk/firebase-database-emulator-v4.4.1.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Ping emulator at [http://localhost:8088] ...
13:02:55.876 [NamespaceSystem-akka.actor.default-dispatcher-5] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
13:02:56.061 [main] INFO com.firebase.server.forge.App$ - Listening at localhost:8088
Ping emulator at [http://localhost:8088] ...
Emulator has started up after 2.027s!

API Changes

N/A

@changeset-bot
Copy link

changeset-bot bot commented Oct 16, 2020

⚠️ No Changeset found

Latest commit: c134ee7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

Binary Size Report

Affected SDKs

No changes between base commit (79b0493) and head commit (97014fc).

Test Logs

@google-oss-bot
Copy link
Contributor

Size Analysis Report

Affected Products

No changes between base commit (79b0493) and head commit (97014fc).

Test Logs

Copy link
Member

@Feiyang1 Feiyang1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 30% improvement!

@samtstern
Copy link
Contributor Author

@Feiyang1 actually the time in those log is irrelevant, we don't measure the time to download but for me this takes ~30s off of every run!

@samtstern samtstern merged commit 973cdfa into master Oct 29, 2020
wu-hui added a commit that referenced this pull request Nov 9, 2020
* Rolls a node app building bundles.

* Build bundle files for given list of project IDs.

* Build the bundle json map and save it for integration tests.

* Add emulator_settings.ts to gulp

* Move bundle.test.ts to api/

* Bundles passes all tests and expose in classic API

* Add CI project ID to bundles.

* Adhoc string replacement and length re-calculation

* Fix lint errors.

* Delete old changes from make node app

* Address comments

* Update yarn.lock for release (#3998)

Temp fix where database version is bumped before firebase-admin can update deps

* Manually prepares the bundle strings.

* Update API

* Update config.ts

* Use Chrome for karma debugging (#4007)

* Cache emulator between runs (#3956)

* Remote Config Modularization (#3975)

* rc exp init

* Add apis

* register rc exp

* implement funcitonal APIs

* fix tests

* build rc exp

* add api-extractor to rc types

* cast directly witout function

* delete changelog for rc exp

* add code owners to rc exp

* update dep version

* Remove AuthErrorCode from core export (#4013)

* Remove AuthErrorCode from core export

* Api

* Update config.ts to remove bundles

* adds a root changelog (#4009)

* adds a root changelog

* Update CHANGELOG.md

Co-authored-by: Feiyang <[email protected]>

* Update dependency typescript to v4.0.5 (#3846)

Co-authored-by: Renovate Bot <[email protected]>

* Update dependency karma-firefox-launcher to v2 (#3987)

Co-authored-by: Renovate Bot <[email protected]>

* Update dependency google-closure-library to v20200830 (#3765)

* Update dependency google-closure-library to v20200830

* Replace goog.isArray with Array.isArray

https://github.com/google/closure-library/releases/tag/v20200628

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Alex Volkovitsky <[email protected]>

* exclude remote config exp packages in changeset (#4014)

* Set 1s timeout for onBackgroundMessage Hook (#3780)

* await onBackgroundMessage hook

* Create fluffy-panthers-hide.md

* block in onPush to let onBackgroundMessage to execute

* polish wording

* Update changeset

to be more specific

* Update fluffy-panthers-hide.md

* Clarify PR is about a bug fix

* Update fluffy-panthers-hide.md

* A whole bunch of things to bring auth (compat) to parity (#3970)

* Handle anonymous auth re-login edge case

* Formatting

* Initial fixes

* Fix redirect

* clean up additional user info

* Formatting

* PR feedback

* Fix some tests

* Fix tests & write some new ones

* Fix broken build

* Formatting

* Formatting

* PR feedback

* Formatting

* PR feedback

Co-authored-by: avolkovi <[email protected]>

* Add withFunctionsTriggersDisabled method to rules-unit-testing (#3928)

* Update integration tests to use free functions

* Functions compat package (#3739)

* Add free functions to exports

* Fix to avoid false failures on changeset checker (#4012)

* Add changeset for Firestore (#4030)

* Update functions-compat dep version and fix changeset script error (#4032)

* Update integration tests. Minified tests fail.

* Bump node memory limit for all test CI (#4035)

* Compat Layer for Firestore (#4003)

* Rename all public API types to PublicX (#4039)

* Update all non-major dependencies (#3953)

Co-authored-by: Renovate Bot <[email protected]>

* Version Packages (#4033)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Set up Storage modularization (#3499)

Refactor storage for modularization.

* Free functions removed from exp database.ts

Co-authored-by: Christina Holland <[email protected]>
Co-authored-by: Sebastian Schmidt <[email protected]>
Co-authored-by: Sam Stern <[email protected]>
Co-authored-by: Feiyang <[email protected]>
Co-authored-by: Sam Horlbeck Olsen <[email protected]>
Co-authored-by: Dimitri Mitropoulos <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Alex Volkovitsky <[email protected]>
Co-authored-by: Kai Wu <[email protected]>
Co-authored-by: Google Open Source Bot <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@firebase firebase locked and limited conversation to collaborators Nov 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants