Skip to content
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

Unit tests for Firestore run very slow #22888

Open
SandeepTuniki opened this issue Sep 5, 2023 · 0 comments
Open

Unit tests for Firestore run very slow #22888

SandeepTuniki opened this issue Sep 5, 2023 · 0 comments
Labels
api: firestore Issues related to the Firestore API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: cleanup An internal cleanup or hygiene concern.

Comments

@SandeepTuniki
Copy link
Contributor

SandeepTuniki commented Sep 5, 2023

The unit tests for the google-cloud-firestore gem take over 2 minutes, which is very slow during local development.

I timed it on my local machine as shown below:

$ toys ci --no-bundle --test

// ... truncated output

Finished in 136.528543s, 7.0315 runs/s, 39.1420 assertions/s.

Below are the list of slow tests (at-least 1 second), in descending order of run time:

# Output for the command: bundle exec rake test TESTOPTS="-v"

# 6+ seconds
Google::Cloud::Firestore::BulkWriter::mock_firestore::thread tests#test_0002_batch threads tests = 6.05 s = .

# 5+ seconds
Google::Cloud::Firestore::BulkWriter::update::mock_firestore#test_0002_retries a update operation = 5.01 s = .
Google::Cloud::Firestore::BulkWriter::mock_firestore::retry tests#test_0005_retry operations in correct order = 5.01 s = .
Google::Cloud::Firestore::BulkWriter::set::mock_firestore#test_0002_retries a set operation = 5.01 s = .
Google::Cloud::Firestore::BulkWriter::delete::mock_firestore#test_0002_retries a delete operation = 5.00 s = .
Google::Cloud::Firestore::BulkWriter::create::mock_firestore#test_0002_retries a create operation = 5.00 s = .

# 3+ seconds
Google::Cloud::Firestore::CollectionReference::listen::backoff::watch_firestore#test_0006_restarts when GRPC::Unavailable is raised = 3.00 s = .
Google::Cloud::Firestore::CollectionReference::listen::backoff::watch_firestore#test_0004_restarts when GRPC::ResourceExhausted is raised = 3.01 s = .
Google::Cloud::Firestore::CollectionReference::listen::backoff::watch_firestore#test_0002_restarts when GRPC::DeadlineExceeded is raised = 3.01 s = .
Google::Cloud::Firestore::CollectionReference::listen::watch_firestore#test_0006_invokes on_error callbacks when the listener receives errors = 3.00 s = .
Google::Cloud::Firestore::DocumentReference::listen::watch_firestore#test_0004_invokes on_error callbacks when the listener receives errors = 3.00 s = .
Google::Cloud::Firestore::CollectionReference::listen::watch_firestore#test_0005_resets when FILTER count is incorrect = 3.01 s = .
Google::Cloud::Firestore::DocumentReference::listen::watch_firestore#test_0003_resets when FILTER count is incorrect = 3.00 s = .
Google::Cloud::Firestore::DocumentReference::listen::retry::watch_firestore#test_0006_restarts when GRPC::Unavailable is raised = 3.00 s = .
Google::Cloud::Firestore::DocumentReference::listen::retry::watch_firestore#test_0002_restarts when GRPC::DeadlineExceeded is raised = 3.00 s = .
Google::Cloud::Firestore::DocumentReference::listen::retry::watch_firestore#test_0004_restarts when GRPC::ResourceExhausted is raised = 3.00 s = .
ConformanceListen#test_/...[truncated_path].../conformance/v1/listen-doc-remove.json: listen: DocumentRemove behaves like DocumentDelete = 3.00 s = .
ConformanceListen#test_/...[truncated_path].../conformance/v1/listen-add-three.json: listen: add three documents = 3.00 s = .
ConformanceListen#test_/...[truncated_path].../conformance/v1/listen-nomod.json: listen: add a doc, then change it but without changing its update time = 3.00 s = .
ConformanceListen#test_/...[truncated_path].../conformance/v1/listen-add-mod-del-add.json: listen: add a doc, modify it, delete it, then add it again = 3.00 s = .
ConformanceListen#test_/...[truncated_path].../conformance/v1/listen-removed-target-ids.json: listen: DocumentChange with removed_target_id is like a delete. = 3.00 s = .
ConformanceListen#test_/...[truncated_path].../conformance/v1/listen-filter-nop.json: listen: Filter response with same size is a no-op = 3.00 s = .
ConformanceListen#test_/...[truncated_path].../conformance/v1/listen-empty.json: listen: no changes; empty snapshot = 3.00 s = .

# 2+ seconds
Google::Cloud::Firestore::CollectionReference::listen::backoff::watch_firestore#test_0003_restarts when GRPC::Internal is raised = 2.00 s = .
Google::Cloud::Firestore::CollectionReference::listen::backoff::watch_firestore#test_0007_restarts when GRPC::Unknown is raised = 2.00 s = .
Google::Cloud::Firestore::CollectionReference::listen::backoff::watch_firestore#test_0005_restarts when GRPC::Unauthenticated is raised = 2.00 s = .
Google::Cloud::Firestore::CollectionReference::listen::watch_firestore#test_0003_listens to a query and yields query snapshots = 2.00 s = .
Google::Cloud::Firestore::CollectionReference::listen::watch_firestore#test_0004_resets when RESET is returned = 2.00 s = .
Google::Cloud::Firestore::CollectionReference::listen::watch_firestore#test_0002_listens to a limit_to_last query = 2.00 s = .
Google::Cloud::Firestore::RateLimiter#test_0002_checks whether the bandwidth increases after phase length = 2.00 s = .
Google::Cloud::Firestore::DocumentReference::listen::watch_firestore#test_0002_resets when RESET is returned = 2.00 s = .
Google::Cloud::Firestore::DocumentReference::listen::retry::watch_firestore#test_0003_restarts when GRPC::Internal is raised = 2.00 s = .
Google::Cloud::Firestore::DocumentReference::listen::retry::watch_firestore#test_0007_restarts when GRPC::Unknown is raised = 2.00 s = .
Google::Cloud::Firestore::DocumentReference::listen::retry::watch_firestore#test_0005_restarts when GRPC::Unauthenticated is raised = 2.00 s = .
ConformanceListen#test_/...[truncated_path].../conformance/v1/listen-target-add-nop.json: listen: TargetChange_ADD is a no-op if it has the same target ID = 2.00 s = .
ConformanceListen#test_/...[truncated_path].../conformance/v1/listen-reset.json: listen: RESET turns off CURRENT = 2.00 s = .
ConformanceListen#test_/...[truncated_path].../conformance/v1/listen-multi-docs.json: listen: multiple documents, added, deleted and updated = 2.00 s = .
ConformanceListen#test_/...[truncated_path].../conformance/v1/listen-add-one.json: listen: add a doc = 2.00 s = .
ConformanceListen#test_/...[truncated_path].../conformance/v1/listen-nocurrent.json: listen: no snapshot if we don't see CURRENT = 2.00 s = .

# 1+ second
Google::Cloud::Firestore::BulkWriter::mock_firestore::retry tests#test_0004_retry only the failed operation of a batch = 1.01 s = .
Google::Cloud::Firestore::BulkWriter::mock_firestore::retry tests#test_0003_retry operations only after retry time = 1.10 s = .
Google::Cloud::Firestore::Promise::Future::mock_firestore#test_0004_correctly returns the rejected reason = 1.20 s = .
Google::Cloud::Firestore::Promise::Future::mock_firestore#test_0006_successfully adds callback on rejection = 1.01 s = .
Google::Cloud::Firestore::BulkWriter::mock_firestore#test_0005_marks operation complete in case of BulkWriterOperationError when mutation was failure = 1.01 s = .
@SandeepTuniki SandeepTuniki added priority: p3 Desirable enhancement or fix. May not be included in next release. api: firestore Issues related to the Firestore API. type: cleanup An internal cleanup or hygiene concern. labels Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the Firestore API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

No branches or pull requests

1 participant