Skip to content

Commit ea2f3ff

Browse files
authored
Firestore: Add SCOPED_TRACE to Await() calls in firestore_integration_test.h/cc (#1051)
1 parent 276ad84 commit ea2f3ff

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

firestore/integration_test_internal/src/firestore_integration_test.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ DocumentReference FirestoreIntegrationTest::DocumentWithData(
237237

238238
void FirestoreIntegrationTest::WriteDocument(DocumentReference reference,
239239
const MapFieldValue& data) const {
240+
SCOPED_TRACE("FirestoreIntegrationTest::WriteDocument(" + reference.path() +
241+
")");
240242
Future<void> future = reference.Set(data);
241243
Stopwatch stopwatch;
242244
Await(future);
@@ -247,13 +249,17 @@ void FirestoreIntegrationTest::WriteDocument(DocumentReference reference,
247249
void FirestoreIntegrationTest::WriteDocuments(
248250
CollectionReference reference,
249251
const std::map<std::string, MapFieldValue>& data) const {
252+
SCOPED_TRACE("FirestoreIntegrationTest::WriteDocuments(" +
253+
std::to_string(data.size()) + " documents)");
250254
for (const auto& kv : data) {
251255
WriteDocument(reference.Document(kv.first), kv.second);
252256
}
253257
}
254258

255259
DocumentSnapshot FirestoreIntegrationTest::ReadDocument(
256260
const DocumentReference& reference) const {
261+
SCOPED_TRACE("FirestoreIntegrationTest::ReadDocument(" + reference.path() +
262+
")");
257263
Future<DocumentSnapshot> future = reference.Get();
258264
Stopwatch stopwatch;
259265
const DocumentSnapshot* result = Await(future);
@@ -267,6 +273,7 @@ DocumentSnapshot FirestoreIntegrationTest::ReadDocument(
267273

268274
QuerySnapshot FirestoreIntegrationTest::ReadDocuments(
269275
const Query& reference) const {
276+
SCOPED_TRACE("FirestoreIntegrationTest::ReadDocuments()");
270277
Future<QuerySnapshot> future = reference.Get();
271278
Stopwatch stopwatch;
272279
const QuerySnapshot* result = Await(future);
@@ -280,6 +287,8 @@ QuerySnapshot FirestoreIntegrationTest::ReadDocuments(
280287

281288
void FirestoreIntegrationTest::DeleteDocument(
282289
DocumentReference reference) const {
290+
SCOPED_TRACE("FirestoreIntegrationTest::DeleteDocument(" + reference.path() +
291+
")");
283292
Future<void> future = reference.Delete();
284293
Stopwatch stopwatch;
285294
Await(future);

firestore/integration_test_internal/src/firestore_integration_test.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ class FirestoreIntegrationTest : public testing::Test {
319319
// Update the specified document and wait for the update to complete.
320320
template <typename MapType>
321321
void UpdateDocument(DocumentReference reference, const MapType& data) const {
322+
SCOPED_TRACE("FirestoreIntegrationTest::UpdateDocument(" +
323+
reference.path() + ")");
322324
Future<void> future = reference.Update(data);
323325
Await(future);
324326
EXPECT_EQ(FutureStatus::kFutureStatusComplete, future.status());
@@ -392,9 +394,15 @@ class FirestoreIntegrationTest : public testing::Test {
392394

393395
static std::string DescribeFailedFuture(const FutureBase& future);
394396

395-
void DisableNetwork() { Await(TestFirestore()->DisableNetwork()); }
397+
void DisableNetwork() {
398+
SCOPED_TRACE("FirestoreIntegrationTest::DisableNetwork()");
399+
Await(TestFirestore()->DisableNetwork());
400+
}
396401

397-
void EnableNetwork() { Await(TestFirestore()->EnableNetwork()); }
402+
void EnableNetwork() {
403+
SCOPED_TRACE("FirestoreIntegrationTest::EnableNetwork()");
404+
Await(TestFirestore()->EnableNetwork());
405+
}
398406

399407
static FirestoreInternal* GetFirestoreInternal(Firestore* firestore) {
400408
return firestore->internal_;

0 commit comments

Comments
 (0)