Skip to content

Commit d392a74

Browse files
Merge pull request GoogleCloudPlatform#2884 from acpana/acpana/fix-de
fix: check set for enum
2 parents dcb1ac6 + 5b68de3 commit d392a74

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

pkg/controller/direct/bigqueryanalyticshub/dataexchange_controller.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ func (a *Adapter) Update(ctx context.Context, updateOp *directbase.UpdateOperati
204204
log.V(2).Info("updating DataExchange", "name", a.id.FullyQualifiedName())
205205
mapCtx := &direct.MapContext{}
206206

207-
// TODO(user): (Optional) Add GCP mutable fields.
208207
// TODO(kcc): Autogen "func immutable()" for each field
209208
// TODO(kcc): autogen updateMastk.path for mutable gcp fields.
210209
updateMask := &fieldmaskpb.FieldMask{}
@@ -224,7 +223,7 @@ func (a *Adapter) Update(ctx context.Context, updateOp *directbase.UpdateOperati
224223
// if !reflect.DeepEqual(a.desired.Spec.Icon, string(a.actual.Icon)) {
225224
// updateMask.Paths = append(updateMask.Paths, "icon")
226225
// }
227-
if !reflect.DeepEqual(a.desired.Spec.DiscoveryType, a.actual.DiscoveryType.String()) {
226+
if a.desired.Spec.DiscoveryType != nil && !reflect.DeepEqual(a.desired.Spec.DiscoveryType, a.actual.DiscoveryType.String()) {
228227
updateMask.Paths = append(updateMask.Paths, "discovery_type")
229228
}
230229

pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshubdataexchange-full/_generated_object_bigqueryanalyticshubdataexchange-full.golden.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ metadata:
1313
namespace: ${uniqueId}
1414
spec:
1515
description: example data exchange
16-
discoveryType: DISCOVERY_TYPE_PRIVATE
16+
discoveryType: DISCOVERY_TYPE_PUBLIC
1717
displayName: my_data_exchange
1818
documentation: an updated documentation
1919
location: US

pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshubdataexchange-full/_http.log

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ x-goog-request-params: parent=projects%2F${projectId}%2Flocations%2FUS
2121

2222
{
2323
"description": "example data exchange",
24-
"discoveryType": 0,
24+
"discoveryType": 1,
2525
"displayName": "my_data_exchange",
2626
"documentation": "a documentation",
2727
"primaryContact": "[email protected]"
@@ -33,7 +33,7 @@ Grpc-Metadata-Content-Type: application/grpc
3333

3434
{
3535
"description": "example data exchange",
36-
"discoveryType": "DISCOVERY_TYPE_UNSPECIFIED",
36+
"discoveryType": "DISCOVERY_TYPE_PRIVATE",
3737
"displayName": "my_data_exchange",
3838
"documentation": "a documentation",
3939
"icon": "",
@@ -56,7 +56,7 @@ Grpc-Metadata-Content-Type: application/grpc
5656

5757
{
5858
"description": "example data exchange",
59-
"discoveryType": "DISCOVERY_TYPE_UNSPECIFIED",
59+
"discoveryType": "DISCOVERY_TYPE_PRIVATE",
6060
"displayName": "my_data_exchange",
6161
"documentation": "a documentation",
6262
"icon": "",
@@ -75,7 +75,7 @@ x-goog-request-params: data_exchange.name=projects%2F${projectId}%2Flocations%2F
7575

7676
{
7777
"description": "example data exchange",
78-
"discoveryType": 1,
78+
"discoveryType": 2,
7979
"displayName": "my_data_exchange",
8080
"documentation": "an updated documentation",
8181
"name": "projects/${projectId}/locations/US/dataExchanges/bigqueryanalyticshubdataexchange${uniqueId}",
@@ -88,7 +88,7 @@ Grpc-Metadata-Content-Type: application/grpc
8888

8989
{
9090
"description": "example data exchange",
91-
"discoveryType": "DISCOVERY_TYPE_PRIVATE",
91+
"discoveryType": "DISCOVERY_TYPE_PUBLIC",
9292
"displayName": "my_data_exchange",
9393
"documentation": "an updated documentation",
9494
"icon": "",
@@ -111,7 +111,7 @@ Grpc-Metadata-Content-Type: application/grpc
111111

112112
{
113113
"description": "example data exchange",
114-
"discoveryType": "DISCOVERY_TYPE_PRIVATE",
114+
"discoveryType": "DISCOVERY_TYPE_PUBLIC",
115115
"displayName": "my_data_exchange",
116116
"documentation": "an updated documentation",
117117
"icon": "",

pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshubdataexchange-full/create.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ spec:
2121
description: example data exchange
2222
primaryContact: [email protected]
2323
documentation: a documentation
24-
discoveryType: DISCOVERY_TYPE_UNSPECIFIED
24+
discoveryType: DISCOVERY_TYPE_PRIVATE
2525
location: US
2626
projectRef:
2727
external: ${projectId}

pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshubdataexchange-full/update.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ spec:
2121
description: example data exchange
2222
primaryContact: [email protected]
2323
documentation: an updated documentation
24-
discoveryType: DISCOVERY_TYPE_PRIVATE
24+
discoveryType: DISCOVERY_TYPE_PUBLIC
2525
location: US
2626
projectRef:
2727
external: ${projectId}

0 commit comments

Comments
 (0)