Skip to content

Commit 815385c

Browse files
committed
Update versions of all actions.
1 parent 72a3a14 commit 815385c

File tree

14 files changed

+25
-67
lines changed

14 files changed

+25
-67
lines changed

.github/workflows/docs.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
docs:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v1
14-
- uses: actions/setup-node@v1
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
1515
with:
1616
node-version: "20"
1717
- name: Cache npm
@@ -25,7 +25,7 @@ jobs:
2525
run: |
2626
npm run docgen:v1
2727
npm run docgen:v2
28-
- uses: actions/upload-artifact@v3
28+
- uses: actions/upload-artifact@v4
2929
name: Upload Docs Preview
3030
with:
3131
name: reference-docs

integration_test/functions/src/index.ts

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { PubSub } from "@google-cloud/pubsub";
2-
import { GoogleAuth } from "google-auth-library";
32
import { Request, Response } from "express";
43
import * as admin from "firebase-admin";
5-
import * as functions from "firebase-functions";
4+
import * as functions from "firebase-functions/v1";
65
import * as fs from "fs";
76
import fetch from "node-fetch";
87

@@ -20,55 +19,17 @@ import * as testLab from "./v1/testLab-utils";
2019
const firebaseConfig = JSON.parse(process.env.FIREBASE_CONFIG);
2120
admin.initializeApp();
2221

23-
// Re-enable no-unused-var check once callable functions are testable again.
24-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2522
async function callHttpsTrigger(name: string, data: any) {
2623
const url = `https://${REGION}-${firebaseConfig.projectId}.cloudfunctions.net/${name}`;
27-
const client = await new GoogleAuth().getIdTokenClient("32555940559.apps.googleusercontent.com");
28-
const resp = await client.request({
29-
url,
24+
const resp = await fetch(url, {
3025
method: "POST",
3126
headers: {
3227
"Content-Type": "application/json",
3328
},
3429
body: JSON.stringify({ data }),
3530
});
36-
if (resp.status > 200) {
37-
throw Error(resp.statusText);
38-
}
39-
}
40-
41-
// Re-enable no-unused-var check once callable functions are testable again.
42-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
43-
async function callV2HttpsTrigger(name: string, data: any, accessToken: string) {
44-
const getFnResp = await fetch(
45-
`https://cloudfunctions.googleapis.com/v2beta/projects/${firebaseConfig.projectId}/locations/${REGION}/functions/${name}`,
46-
{
47-
headers: {
48-
Authorization: `Bearer ${accessToken}`,
49-
},
50-
}
51-
);
52-
if (!getFnResp.ok) {
53-
throw new Error(getFnResp.statusText);
54-
}
55-
const fn = await getFnResp.json();
56-
const uri = fn.serviceConfig?.uri;
57-
if (!uri) {
58-
throw new Error(`Cannot call v2 https trigger ${name} - no uri found`);
59-
}
60-
61-
const client = await new GoogleAuth().getIdTokenClient("32555940559.apps.googleusercontent.com");
62-
const invokeFnREsp = await client.request({
63-
url: uri,
64-
method: "POST",
65-
headers: {
66-
"Content-Type": "application/json",
67-
},
68-
body: JSON.stringify({ data }),
69-
});
70-
if (invokeFnREsp.status > 200) {
71-
throw Error(invokeFnREsp.statusText);
31+
if (!resp.ok) {
32+
throw new Error(`Failed request with status ${resp.status}!`);
7233
}
7334
}
7435

@@ -150,8 +111,7 @@ function v1Tests(testId: string, accessToken: string): Array<Promise<unknown>> {
150111
// A firestore write to trigger the Cloud Firestore tests.
151112
admin.firestore().collection("tests").doc(testId).set({ test: testId }),
152113
// Invoke a callable HTTPS trigger.
153-
// TODO: Temporarily disable - doesn't work unless running on projects w/ permission to create public functions.
154-
// callHttpsTrigger("v1-callableTests", { foo: "bar", testId }),
114+
callHttpsTrigger("v1-callableTests", { foo: "bar", testId }),
155115
// A Remote Config update to trigger the Remote Config tests.
156116
updateRemoteConfig(testId, accessToken),
157117
// A storage upload to trigger the Storage tests
@@ -169,8 +129,7 @@ function v1Tests(testId: string, accessToken: string): Array<Promise<unknown>> {
169129
function v2Tests(testId: string, accessToken: string): Array<Promise<void>> {
170130
return [
171131
// Invoke a callable HTTPS trigger.
172-
// TODO: Temporarily disable - doesn't work unless running on projects w/ permission to create public functions.
173-
// callV2HttpsTrigger("v2-callabletests", { foo: "bar", testId }, accessToken),
132+
callHttpsTrigger("v2-callabletests", { foo: "bar", testId }),
174133
// Invoke a scheduled trigger.
175134
callV2ScheduleTrigger("v2-schedule", "us-central1", accessToken),
176135
];

integration_test/functions/src/testing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as firebase from "firebase-admin";
2-
import * as functions from "firebase-functions";
2+
import * as functions from "firebase-functions/v1";
33

44
export type TestCase<T> = (data: T, context?: functions.EventContext) => any;
55
export interface TestCaseMap<T> {

integration_test/functions/src/v1/auth-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as admin from "firebase-admin";
2-
import * as functions from "firebase-functions";
2+
import * as functions from "firebase-functions/v1";
33
import { REGION } from "../region";
44
import { expectEq, TestSuite } from "../testing";
55
import UserMetadata = admin.auth.UserRecord;

integration_test/functions/src/v1/database-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as admin from "firebase-admin";
2-
import * as functions from "firebase-functions";
2+
import * as functions from "firebase-functions/v1";
33
import { REGION } from "../region";
44
import { expectEq, expectMatches, TestSuite } from "../testing";
55
import DataSnapshot = admin.database.DataSnapshot;

integration_test/functions/src/v1/firestore-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as admin from "firebase-admin";
2-
import * as functions from "firebase-functions";
2+
import * as functions from "firebase-functions/v1";
33
import { REGION } from "../region";
44
import { expectDeepEq, expectEq, TestSuite } from "../testing";
55
import DocumentSnapshot = admin.firestore.DocumentSnapshot;

integration_test/functions/src/v1/https-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as functions from "firebase-functions";
1+
import * as functions from "firebase-functions/v1";
22
import { REGION } from "../region";
33
import { expectEq, TestSuite } from "../testing";
44

integration_test/functions/src/v1/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ export * from "./pubsub-tests";
22
export * from "./database-tests";
33
export * from "./auth-tests";
44
export * from "./firestore-tests";
5-
// Temporarily disable http test - will not work unless running on projects w/ permission to create public functions.
6-
// export * from "./https-tests";
7-
export * from "./remoteConfig-tests";
5+
export * from "./https-tests";
6+
// export * from "./remoteConfig-tests";
87
export * from "./storage-tests";
9-
export * from "./testLab-tests";
8+
// export * from "./testLab-tests";

integration_test/functions/src/v1/pubsub-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as admin from "firebase-admin";
2-
import * as functions from "firebase-functions";
2+
import * as functions from "firebase-functions/v1";
33
import { REGION } from "../region";
44
import { evaluate, expectEq, success, TestSuite } from "../testing";
55
import PubsubMessage = functions.pubsub.Message;

integration_test/functions/src/v1/remoteConfig-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as functions from "firebase-functions";
1+
import * as functions from "firebase-functions/v1";
22
import { REGION } from "../region";
33
import { expectEq, TestSuite } from "../testing";
44
import TemplateVersion = functions.remoteConfig.TemplateVersion;

0 commit comments

Comments
 (0)