@google-cloud/cloud-run-mcp 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/clients.js +222 -0
- package/lib/cloud-api/billing.js +13 -12
- package/lib/cloud-api/build.js +96 -49
- package/lib/cloud-api/helpers.js +7 -27
- package/lib/cloud-api/projects.js +4 -6
- package/lib/cloud-api/registry.js +5 -5
- package/lib/cloud-api/run.js +14 -33
- package/lib/cloud-api/storage.js +6 -7
- package/lib/deployment/deployer.js +10 -55
- package/lib/deployment/helpers.js +1 -1
- package/package.json +2 -2
- package/test/local/clients.test.js +146 -0
- package/test/local/cloud-api/build.test.js +293 -309
- package/test/local/mock-clients.js +35 -0
- package/test/need-gcp/test-helpers.js +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { mock } from 'node:test';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a mock Cloud Build Client.
|
|
5
|
+
* @param {object} [overrides] - Optional overrides for methods.
|
|
6
|
+
* @returns {object} A mock Cloud Build Client.
|
|
7
|
+
*/
|
|
8
|
+
export function getMockCloudBuildClient(overrides = {}) {
|
|
9
|
+
return {
|
|
10
|
+
createBuild:
|
|
11
|
+
overrides.createBuild ||
|
|
12
|
+
mock.fn(() =>
|
|
13
|
+
Promise.resolve([
|
|
14
|
+
{
|
|
15
|
+
metadata: {
|
|
16
|
+
build: {
|
|
17
|
+
id: 'default-mock-build-id',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
])
|
|
22
|
+
),
|
|
23
|
+
getBuild:
|
|
24
|
+
overrides.getBuild ||
|
|
25
|
+
mock.fn(() =>
|
|
26
|
+
Promise.resolve([
|
|
27
|
+
{
|
|
28
|
+
id: 'default-mock-build-id',
|
|
29
|
+
status: 'SUCCESS',
|
|
30
|
+
},
|
|
31
|
+
])
|
|
32
|
+
),
|
|
33
|
+
...overrides,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -163,7 +163,7 @@ export async function setSourceDeployProjectPermissions(projectId) {
|
|
|
163
163
|
const context = {
|
|
164
164
|
serviceUsageClient: serviceUsageClient,
|
|
165
165
|
};
|
|
166
|
-
await ensureApisEnabled(
|
|
166
|
+
await ensureApisEnabled(projectId, ['run.googleapis.com']);
|
|
167
167
|
console.log('Adding editor role to Compute SA...');
|
|
168
168
|
const projectNumber = await getProjectNumber(projectId);
|
|
169
169
|
const member = `serviceAccount:${projectNumber}-compute@developer.gserviceaccount.com`;
|