Skip to content

Commit 9ccf216

Browse files
committed
mockgcp: refactor discoveryengine to "registration" style
1 parent 9837e0c commit 9ccf216

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

mockgcp/mock_http_roundtrip.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ import (
7272
"github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/mockdataplex"
7373
_ "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/mockdataproc"
7474
"github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/mockdatastream"
75-
"github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/mockdiscoveryengine"
75+
_ "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/mockdiscoveryengine"
7676
"github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/mockdocumentai"
7777
"github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/mockedgecontainer"
7878
"github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/mockedgenetwork"
@@ -214,7 +214,6 @@ func NewMockRoundTripper(ctx context.Context, k8sClient client.Client, storage s
214214
services = append(services, mockcontainer.New(env, storage))
215215
services = append(services, mockcertificatemanager.New(env, storage))
216216
services = append(services, mockdataflow.New(env, storage))
217-
services = append(services, mockdiscoveryengine.New(env, storage))
218217
services = append(services, mockedgecontainer.New(env, storage))
219218
services = append(services, mockfirestore.New(env, storage))
220219
services = append(services, mockgkemulticloud.New(env, storage))
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2025 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package mockdiscoveryengine
16+
17+
import (
18+
"github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/mockgcpregistry"
19+
)
20+
21+
var _ mockgcpregistry.SupportsNormalization = &MockService{}
22+
23+
func (s *MockService) ConfigureVisitor(url string, replacements mockgcpregistry.NormalizingVisitor) {
24+
}
25+
26+
func (s *MockService) Previsit(event mockgcpregistry.Event, replacements mockgcpregistry.NormalizingVisitor) {
27+
}

mockgcp/mockdiscoveryengine/service.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ import (
2525
"github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/httpmux"
2626
"github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/operations"
2727
pbhttp "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/google/cloud/discoveryengine/v1"
28+
"github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/mockgcpregistry"
2829
"github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/pkg/storage"
2930
)
3031

32+
func init() {
33+
mockgcpregistry.Register(New)
34+
}
35+
3136
// MockService represents a mocked networkservices service.
3237
type MockService struct {
3338
*common.MockEnvironment
@@ -37,7 +42,7 @@ type MockService struct {
3742
}
3843

3944
// New creates a MockService.
40-
func New(env *common.MockEnvironment, storage storage.Storage) *MockService {
45+
func New(env *common.MockEnvironment, storage storage.Storage) mockgcpregistry.MockService {
4146
s := &MockService{
4247
MockEnvironment: env,
4348
storage: storage,

0 commit comments

Comments
 (0)