Skip to content

Commit b489725

Browse files
authored
fix: Ensure endpoints are correct for mixin clients (googleapis#24032)
1 parent a9c9cfa commit b489725

1,983 files changed

Lines changed: 20604 additions & 5009 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

google-analytics-admin-v1alpha/lib/google/analytics/admin/v1alpha/analytics_admin_service/rest/service_stub.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ def universe_domain
5252
@client_stub.universe_domain
5353
end
5454

55+
##
56+
# The effective endpoint
57+
#
58+
# @return [String]
59+
#
60+
def endpoint
61+
@client_stub.endpoint
62+
end
63+
5564
##
5665
# Baseline implementation for the get_account REST call
5766
#

google-analytics-admin-v1alpha/test/google/analytics/admin/v1alpha/analytics_admin_service_paths_test.rb

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,19 @@
2323
require "google/analytics/admin/v1alpha/analytics_admin_service"
2424

2525
class ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::ClientPathsTest < Minitest::Test
26+
class DummyStub
27+
def endpoint
28+
"endpoint.example.com"
29+
end
30+
31+
def universe_domain
32+
"example.com"
33+
end
34+
end
35+
2636
def test_access_binding_path
2737
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
28-
::Gapic::ServiceStub.stub :new, nil do
38+
::Gapic::ServiceStub.stub :new, DummyStub.new do
2939
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
3040
config.credentials = grpc_channel
3141
end
@@ -40,7 +50,7 @@ def test_access_binding_path
4050

4151
def test_account_path
4252
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
43-
::Gapic::ServiceStub.stub :new, nil do
53+
::Gapic::ServiceStub.stub :new, DummyStub.new do
4454
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
4555
config.credentials = grpc_channel
4656
end
@@ -52,7 +62,7 @@ def test_account_path
5262

5363
def test_ad_sense_link_path
5464
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
55-
::Gapic::ServiceStub.stub :new, nil do
65+
::Gapic::ServiceStub.stub :new, DummyStub.new do
5666
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
5767
config.credentials = grpc_channel
5868
end
@@ -64,7 +74,7 @@ def test_ad_sense_link_path
6474

6575
def test_attribution_settings_path
6676
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
67-
::Gapic::ServiceStub.stub :new, nil do
77+
::Gapic::ServiceStub.stub :new, DummyStub.new do
6878
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
6979
config.credentials = grpc_channel
7080
end
@@ -76,7 +86,7 @@ def test_attribution_settings_path
7686

7787
def test_audience_path
7888
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
79-
::Gapic::ServiceStub.stub :new, nil do
89+
::Gapic::ServiceStub.stub :new, DummyStub.new do
8090
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
8191
config.credentials = grpc_channel
8292
end
@@ -88,7 +98,7 @@ def test_audience_path
8898

8999
def test_big_query_link_path
90100
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
91-
::Gapic::ServiceStub.stub :new, nil do
101+
::Gapic::ServiceStub.stub :new, DummyStub.new do
92102
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
93103
config.credentials = grpc_channel
94104
end
@@ -100,7 +110,7 @@ def test_big_query_link_path
100110

101111
def test_channel_group_path
102112
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
103-
::Gapic::ServiceStub.stub :new, nil do
113+
::Gapic::ServiceStub.stub :new, DummyStub.new do
104114
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
105115
config.credentials = grpc_channel
106116
end
@@ -112,7 +122,7 @@ def test_channel_group_path
112122

113123
def test_conversion_event_path
114124
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
115-
::Gapic::ServiceStub.stub :new, nil do
125+
::Gapic::ServiceStub.stub :new, DummyStub.new do
116126
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
117127
config.credentials = grpc_channel
118128
end
@@ -124,7 +134,7 @@ def test_conversion_event_path
124134

125135
def test_custom_dimension_path
126136
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
127-
::Gapic::ServiceStub.stub :new, nil do
137+
::Gapic::ServiceStub.stub :new, DummyStub.new do
128138
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
129139
config.credentials = grpc_channel
130140
end
@@ -136,7 +146,7 @@ def test_custom_dimension_path
136146

137147
def test_custom_metric_path
138148
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
139-
::Gapic::ServiceStub.stub :new, nil do
149+
::Gapic::ServiceStub.stub :new, DummyStub.new do
140150
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
141151
config.credentials = grpc_channel
142152
end
@@ -148,7 +158,7 @@ def test_custom_metric_path
148158

149159
def test_data_redaction_settings_path
150160
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
151-
::Gapic::ServiceStub.stub :new, nil do
161+
::Gapic::ServiceStub.stub :new, DummyStub.new do
152162
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
153163
config.credentials = grpc_channel
154164
end
@@ -160,7 +170,7 @@ def test_data_redaction_settings_path
160170

161171
def test_data_retention_settings_path
162172
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
163-
::Gapic::ServiceStub.stub :new, nil do
173+
::Gapic::ServiceStub.stub :new, DummyStub.new do
164174
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
165175
config.credentials = grpc_channel
166176
end
@@ -172,7 +182,7 @@ def test_data_retention_settings_path
172182

173183
def test_data_sharing_settings_path
174184
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
175-
::Gapic::ServiceStub.stub :new, nil do
185+
::Gapic::ServiceStub.stub :new, DummyStub.new do
176186
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
177187
config.credentials = grpc_channel
178188
end
@@ -184,7 +194,7 @@ def test_data_sharing_settings_path
184194

185195
def test_data_stream_path
186196
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
187-
::Gapic::ServiceStub.stub :new, nil do
197+
::Gapic::ServiceStub.stub :new, DummyStub.new do
188198
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
189199
config.credentials = grpc_channel
190200
end
@@ -196,7 +206,7 @@ def test_data_stream_path
196206

197207
def test_display_video360_advertiser_link_path
198208
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
199-
::Gapic::ServiceStub.stub :new, nil do
209+
::Gapic::ServiceStub.stub :new, DummyStub.new do
200210
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
201211
config.credentials = grpc_channel
202212
end
@@ -208,7 +218,7 @@ def test_display_video360_advertiser_link_path
208218

209219
def test_display_video360_advertiser_link_proposal_path
210220
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
211-
::Gapic::ServiceStub.stub :new, nil do
221+
::Gapic::ServiceStub.stub :new, DummyStub.new do
212222
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
213223
config.credentials = grpc_channel
214224
end
@@ -220,7 +230,7 @@ def test_display_video360_advertiser_link_proposal_path
220230

221231
def test_enhanced_measurement_settings_path
222232
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
223-
::Gapic::ServiceStub.stub :new, nil do
233+
::Gapic::ServiceStub.stub :new, DummyStub.new do
224234
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
225235
config.credentials = grpc_channel
226236
end
@@ -232,7 +242,7 @@ def test_enhanced_measurement_settings_path
232242

233243
def test_event_create_rule_path
234244
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
235-
::Gapic::ServiceStub.stub :new, nil do
245+
::Gapic::ServiceStub.stub :new, DummyStub.new do
236246
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
237247
config.credentials = grpc_channel
238248
end
@@ -244,7 +254,7 @@ def test_event_create_rule_path
244254

245255
def test_expanded_data_set_path
246256
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
247-
::Gapic::ServiceStub.stub :new, nil do
257+
::Gapic::ServiceStub.stub :new, DummyStub.new do
248258
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
249259
config.credentials = grpc_channel
250260
end
@@ -256,7 +266,7 @@ def test_expanded_data_set_path
256266

257267
def test_firebase_link_path
258268
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
259-
::Gapic::ServiceStub.stub :new, nil do
269+
::Gapic::ServiceStub.stub :new, DummyStub.new do
260270
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
261271
config.credentials = grpc_channel
262272
end
@@ -268,7 +278,7 @@ def test_firebase_link_path
268278

269279
def test_global_site_tag_path
270280
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
271-
::Gapic::ServiceStub.stub :new, nil do
281+
::Gapic::ServiceStub.stub :new, DummyStub.new do
272282
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
273283
config.credentials = grpc_channel
274284
end
@@ -280,7 +290,7 @@ def test_global_site_tag_path
280290

281291
def test_google_ads_link_path
282292
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
283-
::Gapic::ServiceStub.stub :new, nil do
293+
::Gapic::ServiceStub.stub :new, DummyStub.new do
284294
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
285295
config.credentials = grpc_channel
286296
end
@@ -292,7 +302,7 @@ def test_google_ads_link_path
292302

293303
def test_google_signals_settings_path
294304
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
295-
::Gapic::ServiceStub.stub :new, nil do
305+
::Gapic::ServiceStub.stub :new, DummyStub.new do
296306
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
297307
config.credentials = grpc_channel
298308
end
@@ -304,7 +314,7 @@ def test_google_signals_settings_path
304314

305315
def test_measurement_protocol_secret_path
306316
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
307-
::Gapic::ServiceStub.stub :new, nil do
317+
::Gapic::ServiceStub.stub :new, DummyStub.new do
308318
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
309319
config.credentials = grpc_channel
310320
end
@@ -316,7 +326,7 @@ def test_measurement_protocol_secret_path
316326

317327
def test_property_path
318328
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
319-
::Gapic::ServiceStub.stub :new, nil do
329+
::Gapic::ServiceStub.stub :new, DummyStub.new do
320330
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
321331
config.credentials = grpc_channel
322332
end
@@ -328,7 +338,7 @@ def test_property_path
328338

329339
def test_rollup_property_source_link_path
330340
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
331-
::Gapic::ServiceStub.stub :new, nil do
341+
::Gapic::ServiceStub.stub :new, DummyStub.new do
332342
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
333343
config.credentials = grpc_channel
334344
end
@@ -340,7 +350,7 @@ def test_rollup_property_source_link_path
340350

341351
def test_sk_ad_network_conversion_value_schema_path
342352
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
343-
::Gapic::ServiceStub.stub :new, nil do
353+
::Gapic::ServiceStub.stub :new, DummyStub.new do
344354
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
345355
config.credentials = grpc_channel
346356
end
@@ -352,7 +362,7 @@ def test_sk_ad_network_conversion_value_schema_path
352362

353363
def test_search_ads360_link_path
354364
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
355-
::Gapic::ServiceStub.stub :new, nil do
365+
::Gapic::ServiceStub.stub :new, DummyStub.new do
356366
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
357367
config.credentials = grpc_channel
358368
end
@@ -364,7 +374,7 @@ def test_search_ads360_link_path
364374

365375
def test_subproperty_event_filter_path
366376
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
367-
::Gapic::ServiceStub.stub :new, nil do
377+
::Gapic::ServiceStub.stub :new, DummyStub.new do
368378
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
369379
config.credentials = grpc_channel
370380
end

google-analytics-admin-v1alpha/test/google/analytics/admin/v1alpha/analytics_admin_service_rest_test.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ def make_http_request *args, **kwargs
6060

6161
@response
6262
end
63+
64+
def endpoint
65+
"endpoint.example.com"
66+
end
67+
68+
def universe_domain
69+
"example.com"
70+
end
6371
end
6472

6573
def test_get_account
@@ -7258,7 +7266,8 @@ def test_configure
72587266
credentials_token = :dummy_value
72597267

72607268
client = block_config = config = nil
7261-
Gapic::Rest::ClientStub.stub :new, nil do
7269+
dummy_stub = ClientStub.new nil
7270+
Gapic::Rest::ClientStub.stub :new, dummy_stub do
72627271
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Rest::Client.new do |config|
72637272
config.credentials = credentials_token
72647273
end

google-analytics-admin-v1alpha/test/google/analytics/admin/v1alpha/analytics_admin_service_test.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ def call_rpc *args, **kwargs
4545

4646
@response
4747
end
48+
49+
def endpoint
50+
"endpoint.example.com"
51+
end
52+
53+
def universe_domain
54+
"example.com"
55+
end
4856
end
4957

5058
def test_get_account
@@ -8005,7 +8013,8 @@ def test_configure
80058013
grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
80068014

80078015
client = block_config = config = nil
8008-
Gapic::ServiceStub.stub :new, nil do
8016+
dummy_stub = ClientStub.new nil, nil
8017+
Gapic::ServiceStub.stub :new, dummy_stub do
80098018
client = ::Google::Analytics::Admin::V1alpha::AnalyticsAdminService::Client.new do |config|
80108019
config.credentials = grpc_channel
80118020
end

google-analytics-data-v1beta/lib/google/analytics/data/v1beta/analytics_data/rest/service_stub.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ def universe_domain
5252
@client_stub.universe_domain
5353
end
5454

55+
##
56+
# The effective endpoint
57+
#
58+
# @return [String]
59+
#
60+
def endpoint
61+
@client_stub.endpoint
62+
end
63+
5564
##
5665
# Baseline implementation for the run_report REST call
5766
#

google-analytics-data-v1beta/test/google/analytics/data/v1beta/analytics_data_operations_test.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ def call_rpc *args, **kwargs
4545

4646
@response
4747
end
48+
49+
def endpoint
50+
"endpoint.example.com"
51+
end
52+
53+
def universe_domain
54+
"example.com"
55+
end
4856
end
4957

5058
def test_list_operations
@@ -364,7 +372,8 @@ def test_configure
364372
grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
365373

366374
client = block_config = config = nil
367-
Gapic::ServiceStub.stub :new, nil do
375+
dummy_stub = ClientStub.new nil, nil
376+
Gapic::ServiceStub.stub :new, dummy_stub do
368377
client = ::Google::Analytics::Data::V1beta::AnalyticsData::Operations.new do |config|
369378
config.credentials = grpc_channel
370379
end

0 commit comments

Comments
 (0)