Skip to content

Commit 0db89df

Browse files
authored
Merge pull request #1226 from alvaroaleman/fix
🌱 Fix AC generation so it builds and test all submodules
2 parents 8c6352e + a7dd0b0 commit 0db89df

File tree

7 files changed

+26
-64
lines changed

7 files changed

+26
-64
lines changed

pkg/applyconfiguration/testdata/cronjob/api/v1/applyconfiguration/api/v1/cronjobspec.go

Lines changed: 0 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/applyconfiguration/testdata/cronjob/api/v1/applyconfiguration/api/v1/unexportedstruct.go

Lines changed: 0 additions & 24 deletions
This file was deleted.

pkg/applyconfiguration/testdata/cronjob/api/v1/applyconfiguration/utils.go

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/applyconfiguration/testdata/cronjob/api/v1/cronjob_types.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,10 @@ type CronJobSpec struct {
294294
unexportedField string
295295

296296
// This tests that both unexported and exported inline fields are not skipped in the schema generation
297-
unexportedStruct `json:",inline"`
298-
ExportedStruct `json:",inline"`
297+
//
298+
// This currently does not work
299+
//unexportedStruct `json:",inline"`
300+
ExportedStruct `json:",inline"`
299301

300302
// Test of the expression-based validation rule marker, with optional message.
301303
// +kubebuilder:validation:XValidation:rule="self.size() % 2 == 0",message="must have even length"
@@ -363,11 +365,13 @@ type CronJobSpec struct {
363365
// This tests that a slice of IntOrString can also have string validation.
364366
// This can be useful if you want to limit the string to a percentage or integer.
365367
// The XIntOrString marker is a requirement for having a pattern on this type.
366-
// +kubebuilder:validation:items:XIntOrString
367-
// +kubebuilder:validation:items:MaxLength=10
368-
// +kubebuilder:validation:items:MinLength=1
369-
// +kubebuilder:validation:items:Pattern="^((100|[0-9]{1,2})%|[0-9]+)$"
370-
IntOrStringArrayWithAPattern []*intstr.IntOrString `json:"intOrStringArrayWithAPattern,omitempty"`
368+
// -+kubebuilder:validation:items:XIntOrString
369+
// -+kubebuilder:validation:items:MaxLength=10
370+
// -+kubebuilder:validation:items:MinLength=1
371+
// -+kubebuilder:validation:items:Pattern="^((100|[0-9]{1,2})%|[0-9]+)$"
372+
//
373+
// This currently does not work. Remove the leading '-' in the above markers when fixing.
374+
// IntOrStringArrayWithAPattern []*intstr.IntOrString `json:"intOrStringArrayWithAPattern,omitempty"`
371375

372376
// This tests that we can embed protocol correctly (without ending up with allOf).
373377
// Context: https://github.com/kubernetes-sigs/controller-tools/issues/1027

pkg/applyconfiguration/testdata/cronjob/api/v1/groupversion_info.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ import (
2727
)
2828

2929
var (
30-
GroupName = "testdata.kubebuilder.io"
31-
GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
32-
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
30+
GroupName = "testdata.kubebuilder.io"
31+
GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
32+
SchemeGroupVersion = GroupVersion
33+
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
3334

3435
// AddToScheme exists solely to keep the old generators creating valid code
3536
AddToScheme = SchemeBuilder.AddToScheme

pkg/crd/testdata/internal_version/internal_types.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,3 @@ type CronJobList struct {
7272
metav1.ListMeta
7373
Items []CronJob
7474
}
75-
76-
func init() {
77-
SchemeBuilder.Register(&CronJob{}, &CronJobList{})
78-
}

test.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,14 @@ make lint
119119

120120
header_text "running go test"
121121

122-
go test -race ./pkg/... ./cmd/... -parallel 4
122+
for dir in $(find . -name go.mod -exec dirname {} \;); do
123+
# Includes "BadDeepCopy" types that are not supposed to result in
124+
# valid code generation
125+
if [[ "$dir" == "./pkg/deepcopy/testdata" ]]; then continue; fi
126+
127+
# https://github.com/kubernetes-sigs/controller-tools/issues/1227
128+
if [[ "$dir" == "./pkg/webhook/testdata" ]]; then continue; fi
129+
130+
echo "Testing module in $dir"
131+
(cd "$dir" && go test -race ./... -parallel 4)
132+
done

0 commit comments

Comments
 (0)