Skip to content

Commit b041f65

Browse files
fix: failing tests for LRO check methods (#35)
* fix: failing tests for LRO check methods Updated gapic-generator-typescript to v2.1.1. Committer: @alexander-fenster PiperOrigin-RevId: 387841814 Source-Link: googleapis/googleapis@f973532 Source-Link: googleapis/googleapis-gen@acb489d * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent bef495e commit b041f65

File tree

3 files changed

+98
-9
lines changed

3 files changed

+98
-9
lines changed

packages/google-api-serviceusage/src/v1/service_usage_client.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const version = require('../../../package.json').version;
5353
export class ServiceUsageClient {
5454
private _terminated = false;
5555
private _opts: ClientOptions;
56+
private _providedCustomServicePath: boolean;
5657
private _gaxModule: typeof gax | typeof gax.fallback;
5758
private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
5859
private _protos: {};
@@ -64,6 +65,7 @@ export class ServiceUsageClient {
6465
longrunning: {},
6566
batching: {},
6667
};
68+
warn: (code: string, message: string, warnType?: string) => void;
6769
innerApiCalls: {[name: string]: Function};
6870
operationsClient: gax.OperationsClient;
6971
serviceUsageStub?: Promise<{[name: string]: Function}>;
@@ -107,6 +109,9 @@ export class ServiceUsageClient {
107109
const staticMembers = this.constructor as typeof ServiceUsageClient;
108110
const servicePath =
109111
opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath;
112+
this._providedCustomServicePath = !!(
113+
opts?.servicePath || opts?.apiEndpoint
114+
);
110115
const port = opts?.port || staticMembers.port;
111116
const clientConfig = opts?.clientConfig ?? {};
112117
const fallback =
@@ -226,6 +231,9 @@ export class ServiceUsageClient {
226231
// of calling the API is handled in `google-gax`, with this code
227232
// merely providing the destination and request information.
228233
this.innerApiCalls = {};
234+
235+
// Add a warn function to the client constructor so it can be easily tested.
236+
this.warn = gax.warn;
229237
}
230238

231239
/**
@@ -254,7 +262,8 @@ export class ServiceUsageClient {
254262
)
255263
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
256264
(this._protos as any).google.api.serviceusage.v1.ServiceUsage,
257-
this._opts
265+
this._opts,
266+
this._providedCustomServicePath
258267
) as Promise<{[method: string]: Function}>;
259268

260269
// Iterate over each of the methods that the service provides

packages/google-api-serviceusage/src/v1beta1/service_usage_client.ts

+32-8
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const version = require('../../../package.json').version;
4949
export class ServiceUsageClient {
5050
private _terminated = false;
5151
private _opts: ClientOptions;
52+
private _providedCustomServicePath: boolean;
5253
private _gaxModule: typeof gax | typeof gax.fallback;
5354
private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
5455
private _protos: {};
@@ -60,6 +61,7 @@ export class ServiceUsageClient {
6061
longrunning: {},
6162
batching: {},
6263
};
64+
warn: (code: string, message: string, warnType?: string) => void;
6365
innerApiCalls: {[name: string]: Function};
6466
operationsClient: gax.OperationsClient;
6567
serviceUsageStub?: Promise<{[name: string]: Function}>;
@@ -103,6 +105,9 @@ export class ServiceUsageClient {
103105
const staticMembers = this.constructor as typeof ServiceUsageClient;
104106
const servicePath =
105107
opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath;
108+
this._providedCustomServicePath = !!(
109+
opts?.servicePath || opts?.apiEndpoint
110+
);
106111
const port = opts?.port || staticMembers.port;
107112
const clientConfig = opts?.clientConfig ?? {};
108113
const fallback =
@@ -356,6 +361,9 @@ export class ServiceUsageClient {
356361
// of calling the API is handled in `google-gax`, with this code
357362
// merely providing the destination and request information.
358363
this.innerApiCalls = {};
364+
365+
// Add a warn function to the client constructor so it can be easily tested.
366+
this.warn = gax.warn;
359367
}
360368

361369
/**
@@ -384,7 +392,8 @@ export class ServiceUsageClient {
384392
)
385393
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
386394
(this._protos as any).google.api.serviceusage.v1beta1.ServiceUsage,
387-
this._opts
395+
this._opts,
396+
this._providedCustomServicePath
388397
) as Promise<{[method: string]: Function}>;
389398

390399
// Iterate over each of the methods that the service provides
@@ -592,7 +601,7 @@ export class ServiceUsageClient {
592601
name: request.name || '',
593602
});
594603
this.initialize();
595-
gax.warn(
604+
this.warn(
596605
'DEP$ServiceUsage-$GetService',
597606
'GetService is deprecated and may be removed in a future version.',
598607
'DeprecationWarning'
@@ -923,7 +932,7 @@ export class ServiceUsageClient {
923932
name: request.name || '',
924933
});
925934
this.initialize();
926-
gax.warn(
935+
this.warn(
927936
'DEP$ServiceUsage-$EnableService',
928937
'EnableService is deprecated and may be removed in a future version.',
929938
'DeprecationWarning'
@@ -954,6 +963,11 @@ export class ServiceUsageClient {
954963
protos.google.api.serviceusage.v1beta1.OperationMetadata
955964
>
956965
> {
966+
this.warn(
967+
'DEP$ServiceUsage-$checkEnableServiceProgress',
968+
'checkEnableServiceProgress is deprecated and may be removed in a future version.',
969+
'DeprecationWarning'
970+
);
957971
const request = new operationsProtos.google.longrunning.GetOperationRequest(
958972
{name}
959973
);
@@ -1085,7 +1099,7 @@ export class ServiceUsageClient {
10851099
name: request.name || '',
10861100
});
10871101
this.initialize();
1088-
gax.warn(
1102+
this.warn(
10891103
'DEP$ServiceUsage-$DisableService',
10901104
'DisableService is deprecated and may be removed in a future version.',
10911105
'DeprecationWarning'
@@ -1116,6 +1130,11 @@ export class ServiceUsageClient {
11161130
protos.google.api.serviceusage.v1beta1.OperationMetadata
11171131
>
11181132
> {
1133+
this.warn(
1134+
'DEP$ServiceUsage-$checkDisableServiceProgress',
1135+
'checkDisableServiceProgress is deprecated and may be removed in a future version.',
1136+
'DeprecationWarning'
1137+
);
11191138
const request = new operationsProtos.google.longrunning.GetOperationRequest(
11201139
{name}
11211140
);
@@ -1258,7 +1277,7 @@ export class ServiceUsageClient {
12581277
parent: request.parent || '',
12591278
});
12601279
this.initialize();
1261-
gax.warn(
1280+
this.warn(
12621281
'DEP$ServiceUsage-$BatchEnableServices',
12631282
'BatchEnableServices is deprecated and may be removed in a future version.',
12641283
'DeprecationWarning'
@@ -1289,6 +1308,11 @@ export class ServiceUsageClient {
12891308
protos.google.api.serviceusage.v1beta1.OperationMetadata
12901309
>
12911310
> {
1311+
this.warn(
1312+
'DEP$ServiceUsage-$checkBatchEnableServicesProgress',
1313+
'checkBatchEnableServicesProgress is deprecated and may be removed in a future version.',
1314+
'DeprecationWarning'
1315+
);
12921316
const request = new operationsProtos.google.longrunning.GetOperationRequest(
12931317
{name}
12941318
);
@@ -2842,7 +2866,7 @@ export class ServiceUsageClient {
28422866
parent: request.parent || '',
28432867
});
28442868
this.initialize();
2845-
gax.warn(
2869+
this.warn(
28462870
'DEP$ServiceUsage-$ListServices',
28472871
'ListServices is deprecated and may be removed in a future version.',
28482872
'DeprecationWarning'
@@ -2897,7 +2921,7 @@ export class ServiceUsageClient {
28972921
});
28982922
const callSettings = new gax.CallSettings(options);
28992923
this.initialize();
2900-
gax.warn(
2924+
this.warn(
29012925
'DEP$ServiceUsage-$ListServices',
29022926
'ListServices is deprecated and may be removed in a future version.',
29032927
'DeprecationWarning'
@@ -2963,7 +2987,7 @@ export class ServiceUsageClient {
29632987
options = options || {};
29642988
const callSettings = new gax.CallSettings(options);
29652989
this.initialize();
2966-
gax.warn(
2990+
this.warn(
29672991
'DEP$ServiceUsage-$ListServices',
29682992
'ListServices is deprecated and may be removed in a future version.',
29692993
'DeprecationWarning'

0 commit comments

Comments
 (0)