Skip to content

Commit 6afd3f3

Browse files
committed
fix spec fuzzer
1 parent 3bf95db commit 6afd3f3

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"
@@ -65,5 +66,4 @@ import (
6566
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/vmwareengine"
6667
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/workflows"
6768
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/workstations"
68-
_ "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/bigtable"
6969
)

pkg/test/fuzz/generate.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ func fillWithRandom0(t *testing.T, randStream *rand.Rand, msg protoreflect.Messa
100100
case protoreflect.Uint32Kind:
101101
// TODO: handle []uint32
102102

103+
case protoreflect.BytesKind:
104+
listVal := msg.Mutable(field).List()
105+
for j := 0; j < count; j++ {
106+
b := randomBytes(randStream)
107+
listVal.Append(protoreflect.ValueOf(b))
108+
}
109+
103110
default:
104111
t.Fatalf("unhandled field kind %v: %v", field.Kind(), field)
105112
}
@@ -312,6 +319,15 @@ func Visit(msgPath string, msg protoreflect.Message, setter func(v protoreflect.
312319
visitor.VisitPrimitive(path+"[]", el, setter)
313320
}
314321

322+
case protoreflect.BytesKind:
323+
for j := 0; j < count; j++ {
324+
el := listVal.Get(j)
325+
setter := func(v protoreflect.Value) {
326+
listVal.Set(j, v)
327+
}
328+
visitor.VisitPrimitive(path+"[]", el, setter)
329+
}
330+
315331
default:
316332
klog.Fatalf("unhandled field kind %v: %v", field.Kind(), field)
317333
}

0 commit comments

Comments
 (0)