Skip to content

Commit 9adf7cd

Browse files
committed
fix spec fuzzer
1 parent bbca0bd commit 9adf7cd

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

pkg/controller/direct/bigtable/authorizedview_fuzzer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
)
2525

2626
func init() {
27-
fuzztesting.RegisterKRMFuzzer(bigtableAuthorizedViewFuzzer())
27+
fuzztesting.RegisterKRMSpecFuzzer(bigtableAuthorizedViewFuzzer())
2828
}
2929

3030
func bigtableAuthorizedViewFuzzer() fuzztesting.KRMFuzzer {

pkg/controller/direct/bigtable/authorizedview_mapper.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
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+
115
package bigtable
216

317
import (

pkg/controller/direct/register/register.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/bigquerydataset"
2626
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/bigquerydatatransfer"
2727
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/bigqueryreservation"
28+
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/bigtable"
2829
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/certificatemanager"
2930
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/cloudbuild"
3031
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/cloudidentity"
@@ -59,5 +60,4 @@ import (
5960
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/vertexai"
6061
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/workflows"
6162
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/workstations"
62-
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/bigtable"
6363
)

pkg/test/fuzz/generate.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ func fillWithRandom0(t *testing.T, randStream *rand.Rand, msg protoreflect.Messa
9797
case protoreflect.Int32Kind:
9898
// TODO: handle []int32
9999

100+
case protoreflect.BytesKind:
101+
listVal := msg.Mutable(field).List()
102+
for j := 0; j < count; j++ {
103+
b := randomBytes(randStream)
104+
listVal.Append(protoreflect.ValueOf(b))
105+
}
106+
100107
default:
101108
t.Fatalf("unhandled field kind %v: %v", field.Kind(), field)
102109
}
@@ -309,6 +316,15 @@ func Visit(msgPath string, msg protoreflect.Message, setter func(v protoreflect.
309316
visitor.VisitPrimitive(path+"[]", el, setter)
310317
}
311318

319+
case protoreflect.BytesKind:
320+
for j := 0; j < count; j++ {
321+
el := listVal.Get(j)
322+
setter := func(v protoreflect.Value) {
323+
listVal.Set(j, v)
324+
}
325+
visitor.VisitPrimitive(path+"[]", el, setter)
326+
}
327+
312328
default:
313329
klog.Fatalf("unhandled field kind %v: %v", field.Kind(), field)
314330
}

0 commit comments

Comments
 (0)