Skip to content

Commit e24b336

Browse files
authored
test(firestore): remove nightly conditional get_field tests (#9868)
1 parent c9f45fa commit e24b336

2 files changed

Lines changed: 8 additions & 134 deletions

File tree

packages/firestore/test/integration/api/pipeline.test.ts

Lines changed: 4 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { FirebaseError } from '@firebase/util';
2424
import { expect, use } from 'chai';
2525
import chaiAsPromised from 'chai-as-promised';
2626

27-
import { logWarn } from '../../../src/util/log';
2827
import { addEqualityMatcher } from '../../util/equality_matcher';
2928
import { Deferred } from '../../util/promise';
3029
import {
@@ -6573,39 +6572,8 @@ apiDescribe.skipClassic('Pipelines', persistence => {
65736572
.addFields(reviewsSub.toArrayExpression().as('reviews'))
65746573
.select('title', 'reviews');
65756574

6576-
// TODO(dlarocque): Remove these target backend conditionals once the 'get_field' rename has rolled out to prod.
6577-
const host = firestore._getSettings().host;
6578-
const isProd = host === 'firestore.googleapis.com';
6579-
const isNightly = host === 'test-firestore.sandbox.googleapis.com';
6580-
6581-
if (isProd) {
6582-
// The execution of this pipeline is expected to result in a network error
6583-
// from the backend until the breaking change to rename the 'field' expression to
6584-
// 'get_field' has rolled out to prod.
6585-
try {
6586-
const results = await execute(ppl);
6587-
6588-
// If this is reached, the execution of the pipeline didn't throw an error, so the
6589-
// breaking change must have rolled out to prod. We can assert the newly expected behaviour.
6590-
logWarn(
6591-
"The 'get_field' expression rename has rolled out to the prod backend. Remove the target backend conditionals in this test."
6592-
);
6593-
expectResults(results, { title: '1984', reviews: ['Alice'] });
6594-
} catch (err: unknown) {
6595-
const error: Error = err as Error;
6596-
expect(error.message).to.equals(
6597-
"The function 'get_field' does not exist, did you mean 'field'?"
6598-
);
6599-
}
6600-
} else if (isNightly) {
6601-
const results = await execute(ppl);
6602-
expectResults(results, { title: '1984', reviews: ['Alice'] });
6603-
} else {
6604-
expect(false).to.equal(
6605-
true,
6606-
`This test is only expected to run against firestore.googleapis.com or test-firestore.sandbox.googleapis.com, but it instead ran against ${host}`
6607-
);
6608-
}
6575+
const results = await execute(ppl);
6576+
expectResults(results, { title: '1984', reviews: ['Alice'] });
66096577
});
66106578
});
66116579

@@ -6687,39 +6655,8 @@ apiDescribe.skipClassic('Pipelines', persistence => {
66876655
.addFields(reviewsSub.toArrayExpression().as('reviews'))
66886656
.select('title', 'reviews');
66896657

6690-
// TODO(dlarocque): Remove these target backend conditionals once the 'get_field' rename has rolled out to prod.
6691-
const host = firestore._getSettings().host;
6692-
const isProd = host === 'firestore.googleapis.com';
6693-
const isNightly = host === 'test-firestore.sandbox.googleapis.com';
6694-
6695-
if (isProd) {
6696-
// The execution of this pipeline is expected to result in a network error
6697-
// from the backend until the breaking change to rename the 'field' expression to
6698-
// 'get_field' has rolled out to prod.
6699-
try {
6700-
const results = await execute(ppl);
6701-
6702-
// If this is reached, the execution of the pipeline didn't throw an error, so the
6703-
// breaking change must have rolled out to prod. We can assert the newly expected behaviour.
6704-
logWarn(
6705-
"The 'get_field' expression rename has rolled out to the prod backend. Remove the target backend conditionals in this test."
6706-
);
6707-
expectResults(results, { title: '1984', reviews: [] });
6708-
} catch (err: unknown) {
6709-
const error: Error = err as Error;
6710-
expect(error.message).to.equals(
6711-
"The function 'get_field' does not exist, did you mean 'field'?"
6712-
);
6713-
}
6714-
} else if (isNightly) {
6715-
const results = await execute(ppl);
6716-
expectResults(results, { title: '1984', reviews: [] });
6717-
} else {
6718-
expect(false).to.equal(
6719-
true,
6720-
`This test is only expected to run against firestore.googleapis.com or test-firestore.sandbox.googleapis.com, but it instead ran against ${host}`
6721-
);
6722-
}
6658+
const results = await execute(ppl);
6659+
expectResults(results, { title: '1984', reviews: [] });
67236660
});
67246661
});
67256662

packages/firestore/test/lite/pipeline.test.ts

Lines changed: 4 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ import { FindNearestStageOptions } from '../../src/lite-api/stage_options';
5353
import { Timestamp } from '../../src/lite-api/timestamp';
5454
import { writeBatch } from '../../src/lite-api/write_batch';
5555
import { Code, FirestoreError } from '../../src/util/error';
56-
import { logWarn } from '../../src/util/log';
5756
import {
5857
getRunEnterpriseTests,
5958
getTargetBackend,
@@ -6445,39 +6444,8 @@ describe.skipClassic('Firestore Pipelines', () => {
64456444
.addFields(reviewsSub.toArrayExpression().as('reviews'))
64466445
.select('title', 'reviews');
64476446

6448-
// TODO(dlarocque): Remove these target backend conditionals once the 'get_field' rename has rolled out to prod.
6449-
const host = firestore._getSettings().host;
6450-
const isProd = host === 'firestore.googleapis.com';
6451-
const isNightly = host === 'test-firestore.sandbox.googleapis.com';
6452-
6453-
if (isProd) {
6454-
// The execution of this pipeline is expected to result in a network error
6455-
// from the backend until the breaking change to rename the 'field' expression to
6456-
// 'get_field' has rolled out to prod.
6457-
try {
6458-
const results = await execute(ppl);
6459-
6460-
// If this is reached, the execution of the pipeline didn't throw an error, so the
6461-
// breaking change must have rolled out to prod. We can assert the newly expected behaviour.
6462-
logWarn(
6463-
"The 'get_field' expression rename has rolled out to the prod backend. Remove the target backend conditionals in this test."
6464-
);
6465-
expectResults(results, { title: '1984', reviews: ['Alice'] });
6466-
} catch (err: unknown) {
6467-
const error: Error = err as Error;
6468-
expect(error.message).to.equals(
6469-
"Request failed with error: The function 'get_field' does not exist, did you mean 'field'?"
6470-
);
6471-
}
6472-
} else if (isNightly) {
6473-
const results = await execute(ppl);
6474-
expectResults(results, { title: '1984', reviews: ['Alice'] });
6475-
} else {
6476-
expect(false).to.equal(
6477-
true,
6478-
`This test is only expected to run against firestore.googleapis.com or test-firestore.sandbox.googleapis.com, but it instead ran against ${host}`
6479-
);
6480-
}
6447+
const results = await execute(ppl);
6448+
expectResults(results, { title: '1984', reviews: ['Alice'] });
64816449
});
64826450
});
64836451

@@ -6560,39 +6528,8 @@ describe.skipClassic('Firestore Pipelines', () => {
65606528
.addFields(reviewsSub.toArrayExpression().as('reviews'))
65616529
.select('title', 'reviews');
65626530

6563-
// TODO(dlarocque): Remove these target backend conditionals once the 'get_field' rename has rolled out to prod.
6564-
const host = firestore._getSettings().host;
6565-
const isProd = host === 'firestore.googleapis.com';
6566-
const isNightly = host === 'test-firestore.sandbox.googleapis.com';
6567-
6568-
if (isProd) {
6569-
// The execution of this pipeline is expected to result in a network error
6570-
// from the backend until the breaking change to rename the 'field' expression to
6571-
// 'get_field' has rolled out to prod.
6572-
try {
6573-
const results = await execute(ppl);
6574-
6575-
// If this is reached, the execution of the pipeline didn't throw an error, so the
6576-
// breaking change must have rolled out to prod. We can assert the newly expected behaviour.
6577-
logWarn(
6578-
"The 'get_field' expression rename has rolled out to the prod backend. Remove the target backend conditionals in this test."
6579-
);
6580-
expectResults(results, { title: '1984', reviews: [] });
6581-
} catch (err: unknown) {
6582-
const error: Error = err as Error;
6583-
expect(error.message).to.equals(
6584-
"Request failed with error: The function 'get_field' does not exist, did you mean 'field'?"
6585-
);
6586-
}
6587-
} else if (isNightly) {
6588-
const results = await execute(ppl);
6589-
expectResults(results, { title: '1984', reviews: [] });
6590-
} else {
6591-
expect(false).to.equal(
6592-
true,
6593-
`This test is only expected to run against firestore.googleapis.com or test-firestore.sandbox.googleapis.com, but it instead ran against ${host}`
6594-
);
6595-
}
6531+
const results = await execute(ppl);
6532+
expectResults(results, { title: '1984', reviews: [] });
65966533
});
65976534
});
65986535

0 commit comments

Comments
 (0)