Skip to content

Commit f0cc355

Browse files
authored
test: verify VPC connector path preservation (#10505)
1 parent d66ec89 commit f0cc355

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

src/deploy/functions/prepare.spec.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,35 @@ describe("prepare", () => {
259259
);
260260
});
261261

262+
it("resolves region and preserves pre-formatted VPC connector paths", async () => {
263+
const want = build.of({
264+
id: {
265+
platform: "gcfv2",
266+
entryPoint: "entry",
267+
project: "project",
268+
runtime: latest("nodejs"),
269+
httpsTrigger: {},
270+
region: [build.REGION_TBD],
271+
vpc: {
272+
connector: "projects/my-project/locations/us-central1/connectors/my-connector",
273+
},
274+
},
275+
});
276+
277+
const haveE = { ...ENDPOINT, id: "id", region: "us-east1" };
278+
const have = backend.of(haveE);
279+
280+
await prepare.resolveDefaultRegionsForBuild(want, have);
281+
expect(want.endpoints["id"].region).to.deep.equal(["us-east1"]);
282+
283+
const backendResult = build.toBackend(want, {});
284+
const endpointDef = backendResult.endpoints["us-east1"]?.["id"];
285+
expect(endpointDef).to.not.be.undefined;
286+
expect(endpointDef?.vpc?.connector).to.equal(
287+
"projects/my-project/locations/us-central1/connectors/my-connector",
288+
);
289+
});
290+
262291
it("throws error if ambiguous", async () => {
263292
const want = build.of({
264293
id: {

0 commit comments

Comments
 (0)