Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 9d411e0
Author: Tim Pansino <timpansino@gmail.com>
Date:   Wed Jul 26 15:57:39 2023 -0700

    Clean out unnecessary code

commit cb550ba
Author: Tim Pansino <timpansino@gmail.com>
Date:   Wed Jul 26 14:27:01 2023 -0700

    Allow better parallelization in firestore tests
  • Loading branch information
TimPansino committed Jul 26, 2023
1 parent c49a1cf commit 7851baf
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 40 deletions.
10 changes: 1 addition & 9 deletions tests/datastore_firestore/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
# limitations under the License.
import pytest

from newrelic.api.time_trace import current_trace
from newrelic.api.datastore_trace import DatastoreTrace
from testing_support.db_settings import firestore_settings
from testing_support.validators.validate_transaction_metrics import validate_transaction_metrics
from newrelic.api.background_task import background_task
from testing_support.validators.validate_database_duration import (
Expand Down Expand Up @@ -48,6 +45,7 @@ def test_firestore_client(client, collection, existing_document):
("Datastore/allOther", 2),
]

@validate_database_duration()
@validate_transaction_metrics(
"test_firestore_client",
scoped_metrics=_test_scoped_metrics,
Expand All @@ -68,9 +66,3 @@ def test_firestore_client_generators(client, collection, assert_trace_for_genera

assert_trace_for_generator(client.collections)
assert_trace_for_generator(client.get_all, [doc])


@validate_database_duration()
@background_task()
def test_firestore_client_db_duration(client, collection, existing_document):
_exercise_client(client, collection, existing_document)
9 changes: 1 addition & 8 deletions tests/datastore_firestore/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from newrelic.api.time_trace import current_trace
from newrelic.api.datastore_trace import DatastoreTrace
from testing_support.validators.validate_transaction_metrics import validate_transaction_metrics
from newrelic.api.background_task import background_task
from testing_support.validators.validate_database_duration import (
Expand Down Expand Up @@ -50,6 +48,7 @@ def test_firestore_collections(collection):
("Datastore/all", 5),
("Datastore/allOther", 5),
]
@validate_database_duration()
@validate_transaction_metrics(
"test_firestore_collections",
scoped_metrics=_test_scoped_metrics,
Expand All @@ -71,9 +70,3 @@ def test_firestore_collections_generators(collection, assert_trace_for_generator

assert_trace_for_generator(collection.stream)
assert_trace_for_generator(collection.list_documents)


@validate_database_duration()
@background_task()
def test_firestore_collections_db_duration(collection):
_exercise_collections(collection)
9 changes: 1 addition & 8 deletions tests/datastore_firestore/test_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from newrelic.api.time_trace import current_trace
from newrelic.api.datastore_trace import DatastoreTrace
from testing_support.validators.validate_transaction_metrics import validate_transaction_metrics
from newrelic.api.background_task import background_task
from testing_support.validators.validate_database_duration import (
Expand Down Expand Up @@ -59,6 +57,7 @@ def test_firestore_documents(collection):
("Datastore/all", 7),
("Datastore/allOther", 7),
]
@validate_database_duration()
@validate_transaction_metrics(
"test_firestore_documents",
scoped_metrics=_test_scoped_metrics,
Expand All @@ -81,9 +80,3 @@ def test_firestore_documents_generators(collection, assert_trace_for_generator):
assert len([_ for _ in subcollection_doc.collections()]) == 2

assert_trace_for_generator(subcollection_doc.collections)


@validate_database_duration()
@background_task()
def test_firestore_documents_db_duration(collection):
_exercise_documents(collection)
14 changes: 2 additions & 12 deletions tests/datastore_firestore/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def test_firestore_query(collection):
("Datastore/all", 2),
("Datastore/allOther", 2),
]
@validate_database_duration()
@validate_transaction_metrics(
"test_firestore_query",
scoped_metrics=_test_scoped_metrics,
Expand All @@ -65,12 +66,6 @@ def test_firestore_query_generators(collection, assert_trace_for_generator):
query = collection.select("x").where(field_path="x", op_string="<=", value=3)
assert_trace_for_generator(query.stream)


@validate_database_duration()
@background_task()
def test_firestore_query_db_duration(collection):
_exercise_query(collection)

# ===== AggregationQuery =====

def _exercise_aggregation_query(collection):
Expand All @@ -91,6 +86,7 @@ def test_firestore_aggregation_query(collection):
("Datastore/all", 2),
("Datastore/allOther", 2),
]
@validate_database_duration()
@validate_transaction_metrics(
"test_firestore_aggregation_query",
scoped_metrics=_test_scoped_metrics,
Expand All @@ -108,9 +104,3 @@ def _test():
def test_firestore_aggregation_query_generators(collection, assert_trace_for_generator):
aggregation_query = collection.select("x").where(field_path="x", op_string="<=", value=3).count()
assert_trace_for_generator(aggregation_query.stream)


@validate_database_duration()
@background_task()
def test_firestore_aggregation_query_db_duration(collection):
_exercise_aggregation_query(collection)
3 changes: 0 additions & 3 deletions tests/datastore_firestore/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
# limitations under the License.
import pytest

from newrelic.api.time_trace import current_trace
from newrelic.api.datastore_trace import DatastoreTrace
from testing_support.db_settings import firestore_settings
from testing_support.validators.validate_transaction_metrics import validate_transaction_metrics
from newrelic.api.background_task import background_task
from testing_support.validators.validate_database_duration import (
Expand Down

0 comments on commit 7851baf

Please sign in to comment.