Skip to content

Commit d1bd2a5

Browse files
committed
Fix all v1 endpoint test failures.
1 parent eb11f95 commit d1bd2a5

27 files changed

+151
-138
lines changed

spec/fixtures.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ManifestEndpoint } from "../src/runtime/manifest";
22
import { RESET_VALUE } from "../src/common/options";
33

4-
export const MINIMAL_ENDPOINT: ManifestEndpoint = {
4+
export const MINIMAL_V2_ENDPOINT: ManifestEndpoint = {
55
availableMemoryMb: RESET_VALUE,
66
concurrency: RESET_VALUE,
77
ingressSettings: RESET_VALUE,
@@ -15,6 +15,19 @@ export const MINIMAL_ENDPOINT: ManifestEndpoint = {
1515
},
1616
};
1717

18+
export const MINIMAL_V1_ENDPOINT: ManifestEndpoint = {
19+
availableMemoryMb: RESET_VALUE,
20+
ingressSettings: RESET_VALUE,
21+
maxInstances: RESET_VALUE,
22+
minInstances: RESET_VALUE,
23+
serviceAccountEmail: RESET_VALUE,
24+
timeoutSeconds: RESET_VALUE,
25+
vpc: {
26+
connector: RESET_VALUE,
27+
egressSettings: RESET_VALUE,
28+
},
29+
};
30+
1831
export const FULL_ENDPOINT: ManifestEndpoint = {
1932
region: ["us-west1"],
2033
availableMemoryMb: 512,

spec/runtime/loader.spec.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as functions from "../../src/v1";
55
import * as loader from "../../src/runtime/loader";
66
import { ManifestEndpoint, ManifestRequiredAPI, ManifestStack } from "../../src/runtime/manifest";
77
import { clearParams } from "../../src/params";
8-
import { MINIMAL_ENDPOINT } from "../fixtures";
8+
import { MINIMAL_V1_ENDPOINT, MINIMAL_V2_ENDPOINT } from "../fixtures";
99
import { MINIMAL_SCHEDULE_TRIGGER, MINIMIAL_TASK_QUEUE_TRIGGER } from "../v1/providers/fixtures";
1010

1111
describe("extractStack", () => {
@@ -35,12 +35,12 @@ describe("extractStack", () => {
3535

3636
expect(endpoints).to.be.deep.equal({
3737
http: {
38-
...MINIMAL_ENDPOINT,
38+
...MINIMAL_V1_ENDPOINT,
3939
entryPoint: "http",
4040
...httpEndpoint,
4141
},
4242
callable: {
43-
...MINIMAL_ENDPOINT,
43+
...MINIMAL_V1_ENDPOINT,
4444
entryPoint: "callable",
4545
...callableEndpoint,
4646
},
@@ -61,7 +61,7 @@ describe("extractStack", () => {
6161

6262
expect(endpoints).to.be.deep.equal({
6363
taskq: {
64-
...MINIMAL_ENDPOINT,
64+
...MINIMAL_V1_ENDPOINT,
6565
entryPoint: "taskq",
6666
platform: "gcfv1",
6767
taskQueueTrigger: MINIMIAL_TASK_QUEUE_TRIGGER,
@@ -91,12 +91,12 @@ describe("extractStack", () => {
9191

9292
expect(endpoints).to.be.deep.equal({
9393
fn1: {
94-
...MINIMAL_ENDPOINT,
94+
...MINIMAL_V1_ENDPOINT,
9595
entryPoint: "fn1",
9696
...httpEndpoint,
9797
},
9898
"g1-fn2": {
99-
...MINIMAL_ENDPOINT,
99+
...MINIMAL_V1_ENDPOINT,
100100
entryPoint: "g1.fn2",
101101
...httpEndpoint,
102102
},
@@ -129,7 +129,7 @@ describe("extractStack", () => {
129129

130130
expect(endpoints).to.be.deep.equal({
131131
fn: {
132-
...MINIMAL_ENDPOINT,
132+
...MINIMAL_V1_ENDPOINT,
133133
entryPoint: "fn",
134134
platform: "gcfv1",
135135
eventTrigger: {
@@ -156,7 +156,7 @@ describe("extractStack", () => {
156156

157157
expect(endpoints).to.be.deep.equal({
158158
scheduled: {
159-
...MINIMAL_ENDPOINT,
159+
...MINIMAL_V1_ENDPOINT,
160160
entryPoint: "scheduled",
161161
platform: "gcfv1",
162162
// TODO: This label should not exist?
@@ -232,27 +232,27 @@ describe("loadStack", () => {
232232
const expected: ManifestStack = {
233233
endpoints: {
234234
v1http: {
235-
...MINIMAL_ENDPOINT,
235+
...MINIMAL_V1_ENDPOINT,
236236
platform: "gcfv1",
237237
entryPoint: "v1http",
238238
httpsTrigger: {},
239239
},
240240
v1callable: {
241-
...MINIMAL_ENDPOINT,
241+
...MINIMAL_V1_ENDPOINT,
242242
platform: "gcfv1",
243243
entryPoint: "v1callable",
244244
labels: {},
245245
callableTrigger: {},
246246
},
247247
v2http: {
248-
...MINIMAL_ENDPOINT,
248+
...MINIMAL_V2_ENDPOINT,
249249
platform: "gcfv2",
250250
entryPoint: "v2http",
251251
labels: {},
252252
httpsTrigger: {},
253253
},
254254
v2callable: {
255-
...MINIMAL_ENDPOINT,
255+
...MINIMAL_V2_ENDPOINT,
256256
platform: "gcfv2",
257257
entryPoint: "v2callable",
258258
labels: {},
@@ -312,13 +312,13 @@ describe("loadStack", () => {
312312
endpoints: {
313313
...expected.endpoints,
314314
"g1-groupedhttp": {
315-
...MINIMAL_ENDPOINT,
315+
...MINIMAL_V1_ENDPOINT,
316316
platform: "gcfv1",
317317
entryPoint: "g1.groupedhttp",
318318
httpsTrigger: {},
319319
},
320320
"g1-groupedcallable": {
321-
...MINIMAL_ENDPOINT,
321+
...MINIMAL_V1_ENDPOINT,
322322
platform: "gcfv1",
323323
entryPoint: "g1.groupedcallable",
324324
labels: {},

spec/v1/cloud-functions.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
MakeCloudFunctionArgs,
3030
RESET_VALUE,
3131
} from "../../src/v1";
32-
import { MINIMAL_ENDPOINT } from "../fixtures";
32+
import { MINIMAL_V1_ENDPOINT } from "../fixtures";
3333

3434
describe("makeCloudFunction", () => {
3535
const cloudFunctionArgs: MakeCloudFunctionArgs<any> = {
@@ -51,7 +51,7 @@ describe("makeCloudFunction", () => {
5151
});
5252

5353
expect(cf.__endpoint).to.deep.equal({
54-
...MINIMAL_ENDPOINT,
54+
...MINIMAL_V1_ENDPOINT,
5555
platform: "gcfv1",
5656
eventTrigger: {
5757
eventType: "mock.provider.mock.event",
@@ -68,7 +68,7 @@ describe("makeCloudFunction", () => {
6868
const cf = makeCloudFunction(cloudFunctionArgs);
6969

7070
expect(cf.__endpoint).to.deep.equal({
71-
...MINIMAL_ENDPOINT,
71+
...MINIMAL_V1_ENDPOINT,
7272
platform: "gcfv1",
7373
eventTrigger: {
7474
eventType: "providers/provider/eventTypes/event",
@@ -98,7 +98,7 @@ describe("makeCloudFunction", () => {
9898
});
9999

100100
expect(cf.__endpoint).to.deep.equal({
101-
...MINIMAL_ENDPOINT,
101+
...MINIMAL_V1_ENDPOINT,
102102
platform: "gcfv1",
103103
timeoutSeconds: 10,
104104
region: ["us-central1"],
@@ -127,7 +127,7 @@ describe("makeCloudFunction", () => {
127127
});
128128

129129
expect(cf.__endpoint).to.deep.equal({
130-
...MINIMAL_ENDPOINT,
130+
...MINIMAL_V1_ENDPOINT,
131131
platform: "gcfv1",
132132
eventTrigger: {
133133
eventType: "mock.provider.mock.event",
@@ -157,7 +157,7 @@ describe("makeCloudFunction", () => {
157157
},
158158
});
159159
expect(cf.__endpoint).to.deep.equal({
160-
...MINIMAL_ENDPOINT,
160+
...MINIMAL_V1_ENDPOINT,
161161
platform: "gcfv1",
162162
scheduleTrigger: {
163163
...schedule,

spec/v1/providers/analytics.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import * as functions from "../../../src/v1";
2626
import { Event } from "../../../src/v1/cloud-functions";
2727
import * as analytics from "../../../src/v1/providers/analytics";
2828
import * as analyticsSpecInput from "./analytics.spec.input";
29-
import { MINIMAL_ENDPOINT } from "../../fixtures";
29+
import { MINIMAL_V1_ENDPOINT } from "../../fixtures";
3030

3131
describe("Analytics Functions", () => {
3232
describe("EventBuilder", () => {
@@ -58,7 +58,7 @@ describe("Analytics Functions", () => {
5858
const cloudFunction = analytics.event("first_open").onLog(() => null);
5959

6060
expect(cloudFunction.__endpoint).to.deep.equal({
61-
...MINIMAL_ENDPOINT,
61+
...MINIMAL_V1_ENDPOINT,
6262
platform: "gcfv1",
6363
eventTrigger: {
6464
eventFilters: {

spec/v1/providers/auth.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { UserRecord } from "../../../src/common/providers/identity";
2525
import * as functions from "../../../src/v1";
2626
import { CloudFunction, Event } from "../../../src/v1/cloud-functions";
2727
import * as auth from "../../../src/v1/providers/auth";
28-
import { MINIMAL_ENDPOINT } from "../../fixtures";
28+
import { MINIMAL_V1_ENDPOINT } from "../../fixtures";
2929

3030
describe("Auth Functions", () => {
3131
const event: Event = {
@@ -49,7 +49,7 @@ describe("Auth Functions", () => {
4949
describe("AuthBuilder", () => {
5050
function expectedEndpoint(project: string, eventType: string) {
5151
return {
52-
...MINIMAL_ENDPOINT,
52+
...MINIMAL_V1_ENDPOINT,
5353
platform: "gcfv1",
5454
eventTrigger: {
5555
eventFilters: {
@@ -116,7 +116,7 @@ describe("Auth Functions", () => {
116116
const fn = auth.user().beforeCreate(() => Promise.resolve());
117117

118118
expect(fn.__endpoint).to.deep.equal({
119-
...MINIMAL_ENDPOINT,
119+
...MINIMAL_V1_ENDPOINT,
120120
platform: "gcfv1",
121121
labels: {},
122122
blockingTrigger: {
@@ -152,7 +152,7 @@ describe("Auth Functions", () => {
152152
.beforeCreate(() => Promise.resolve());
153153

154154
expect(fn.__endpoint).to.deep.equal({
155-
...MINIMAL_ENDPOINT,
155+
...MINIMAL_V1_ENDPOINT,
156156
platform: "gcfv1",
157157
labels: {},
158158
region: ["us-east1"],
@@ -181,7 +181,7 @@ describe("Auth Functions", () => {
181181
const fn = auth.user().beforeSignIn(() => Promise.resolve());
182182

183183
expect(fn.__endpoint).to.deep.equal({
184-
...MINIMAL_ENDPOINT,
184+
...MINIMAL_V1_ENDPOINT,
185185
platform: "gcfv1",
186186
labels: {},
187187
blockingTrigger: {
@@ -217,7 +217,7 @@ describe("Auth Functions", () => {
217217
.beforeSignIn(() => Promise.resolve());
218218

219219
expect(fn.__endpoint).to.deep.equal({
220-
...MINIMAL_ENDPOINT,
220+
...MINIMAL_V1_ENDPOINT,
221221
platform: "gcfv1",
222222
labels: {},
223223
region: ["us-east1"],

spec/v1/providers/database.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ import { applyChange } from "../../../src/common/utilities/utils";
2727
import * as functions from "../../../src/v1";
2828
import * as database from "../../../src/v1/providers/database";
2929
import { expectType } from "../../common/metaprogramming";
30-
import { MINIMAL_ENDPOINT } from "../../fixtures";
30+
import { MINIMAL_V1_ENDPOINT } from "../../fixtures";
3131

3232
describe("Database Functions", () => {
3333
describe("DatabaseBuilder", () => {
3434
// TODO add tests for building a data or change based on the type of operation
3535

3636
function expectedEndpoint(resource: string, eventType: string) {
3737
return {
38-
...MINIMAL_ENDPOINT,
38+
...MINIMAL_V1_ENDPOINT,
3939
platform: "gcfv1",
4040
eventTrigger: {
4141
eventFilters: {

spec/v1/providers/firestore.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { Timestamp } from "firebase-admin/firestore";
2626
import * as functions from "../../../src/v1";
2727
import * as firestore from "../../../src/v1/providers/firestore";
2828
import { expectType } from "../../common/metaprogramming";
29-
import { MINIMAL_ENDPOINT } from "../../fixtures";
29+
import { MINIMAL_V1_ENDPOINT } from "../../fixtures";
3030

3131
describe("Firestore Functions", () => {
3232
function constructValue(fields: any) {
@@ -94,7 +94,7 @@ describe("Firestore Functions", () => {
9494
describe("document builders and event types", () => {
9595
function expectedEndpoint(resource: string, eventType: string) {
9696
return {
97-
...MINIMAL_ENDPOINT,
97+
...MINIMAL_V1_ENDPOINT,
9898
platform: "gcfv1",
9999
eventTrigger: {
100100
eventFilters: {

spec/v1/providers/https.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import * as functions from "../../../src/v1";
2626
import * as https from "../../../src/v1/providers/https";
2727
import { expectedResponseHeaders, MockRequest } from "../../fixtures/mockrequest";
2828
import { runHandler } from "../../helper";
29-
import { MINIMAL_ENDPOINT } from "../../fixtures";
29+
import { MINIMAL_V1_ENDPOINT } from "../../fixtures";
3030

3131
describe("CloudHttpsBuilder", () => {
3232
describe("#onRequest", () => {
@@ -35,7 +35,7 @@ describe("CloudHttpsBuilder", () => {
3535
resp.send(200);
3636
});
3737
expect(result.__endpoint).to.deep.equal({
38-
...MINIMAL_ENDPOINT,
38+
...MINIMAL_V1_ENDPOINT,
3939
platform: "gcfv1",
4040
httpsTrigger: {},
4141
});
@@ -66,7 +66,7 @@ describe("#onCall", () => {
6666
});
6767

6868
expect(result.__endpoint).to.deep.equal({
69-
...MINIMAL_ENDPOINT,
69+
...MINIMAL_V1_ENDPOINT,
7070
platform: "gcfv1",
7171
callableTrigger: {},
7272
labels: {},

spec/v1/providers/pubsub.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import { expect } from "chai";
2424

2525
import { Event, RESET_VALUE } from "../../../src/v1";
26-
import { MINIMAL_ENDPOINT } from "../../fixtures";
26+
import { MINIMAL_V1_ENDPOINT } from "../../fixtures";
2727
import { MINIMAL_SCHEDULE_TRIGGER } from "./fixtures";
2828
import * as functions from "../../../src/v1";
2929
import * as pubsub from "../../../src/v1/providers/pubsub";
@@ -94,7 +94,7 @@ describe("Pubsub Functions", () => {
9494
const result = pubsub.topic("toppy").onPublish(() => null);
9595

9696
expect(result.__endpoint).to.deep.equal({
97-
...MINIMAL_ENDPOINT,
97+
...MINIMAL_V1_ENDPOINT,
9898
platform: "gcfv1",
9999
eventTrigger: {
100100
eventType: "google.pubsub.topic.publish",

spec/v1/providers/remoteConfig.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { expect } from "chai";
2424
import * as functions from "../../../src/v1";
2525
import { CloudFunction, Event } from "../../../src/v1/cloud-functions";
2626
import * as remoteConfig from "../../../src/v1/providers/remoteConfig";
27-
import { MINIMAL_ENDPOINT } from "../../fixtures";
27+
import { MINIMAL_V1_ENDPOINT } from "../../fixtures";
2828

2929
describe("RemoteConfig Functions", () => {
3030
function constructVersion() {
@@ -54,7 +54,7 @@ describe("RemoteConfig Functions", () => {
5454
const cloudFunction = remoteConfig.onUpdate(() => null);
5555

5656
expect(cloudFunction.__endpoint).to.deep.equal({
57-
...MINIMAL_ENDPOINT,
57+
...MINIMAL_V1_ENDPOINT,
5858
platform: "gcfv1",
5959
eventTrigger: {
6060
eventType: "google.firebase.remoteconfig.update",

spec/v1/providers/storage.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ import { Event } from "../../../src/v1";
2525
import * as config from "../../../src/common/config";
2626
import * as functions from "../../../src/v1";
2727
import * as storage from "../../../src/v1/providers/storage";
28-
import { MINIMAL_ENDPOINT } from "../../fixtures";
28+
import { MINIMAL_V1_ENDPOINT } from "../../fixtures";
2929

3030
describe("Storage Functions", () => {
3131
describe("ObjectBuilder", () => {
3232
function expectedEndpoint(bucket: string, eventType: string) {
3333
return {
34-
...MINIMAL_ENDPOINT,
34+
...MINIMAL_V1_ENDPOINT,
3535
platform: "gcfv1",
3636
eventTrigger: {
3737
eventFilters: {

0 commit comments

Comments
 (0)