Skip to content

Commit

Permalink
Update crd fuzzer (#91)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha authored Dec 31, 2023
1 parent 6c42ed8 commit 9853d93
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ concurrency:
jobs:
build:
name: Build
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:

- name: Set up Go 1.21
Expand All @@ -42,11 +42,11 @@ jobs:
kubernetes:
name: Kubernetes
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: build
strategy:
matrix:
k8s: [v1.19.16, v1.20.15, v1.21.14, v1.22.17, v1.23.17, v1.24.12, v1.25.8, v1.26.3, v1.27.1]
k8s: [v1.20.15, v1.21.14, v1.22.17, v1.23.17, v1.24.12, v1.25.8, v1.26.3, v1.27.1, v1.28.0, v1.29.0]
steps:
- uses: actions/checkout@v1

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-tracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
build:
name: Build
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v1
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ version:
.PHONY: clientset
clientset:
@docker run --rm \
-u $$(id -u):$$(id -g) \
-v /tmp:/.cache \
-v $$(pwd):$(DOCKER_REPO_ROOT) \
-w $(DOCKER_REPO_ROOT) \
Expand Down
2 changes: 1 addition & 1 deletion apis/kubevault/v1alpha1/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ func TestConvert_v1alpha1_RaftSpec_To_v1alpha2_RaftSpec(t *testing.T) {
Storage: &v1.PersistentVolumeClaimSpec{
AccessModes: nil,
Selector: nil,
Resources: v1.ResourceRequirements{},
Resources: v1.VolumeResourceRequirements{},
VolumeName: "",
StorageClassName: nil,
VolumeMode: nil,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
k8s.io/klog/v2 v2.110.1
k8s.io/kube-openapi v0.0.0-20231129212854-f0671cc7e66a
kmodules.xyz/client-go v0.29.4
kmodules.xyz/crd-schema-fuzz v0.29.0
kmodules.xyz/crd-schema-fuzz v0.29.1
kmodules.xyz/custom-resources v0.29.0
kmodules.xyz/monitoring-agent-api v0.29.0
kmodules.xyz/offshoot-api v0.29.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk=
kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80=
kmodules.xyz/client-go v0.29.4 h1:WW4vlYtzLc9JXrJjcFuJO4DX/kIZ5ia7QtDyhNDUwfI=
kmodules.xyz/client-go v0.29.4/go.mod h1:xWlS/1zWkx1sIKCAkzULy9570mHZYi2exDECEoP1ek4=
kmodules.xyz/crd-schema-fuzz v0.29.0 h1:s6ATG46aWyP+SoBQU00/kL/7AS2AEWwkSPwVjU512vM=
kmodules.xyz/crd-schema-fuzz v0.29.0/go.mod h1:n708z9YQqLMP2KNLQVgBcRJw1QpSWLvpNCEi+KJDOYE=
kmodules.xyz/crd-schema-fuzz v0.29.1 h1:zJTlWYOrT5dsVVHW8HGcnR/vaWfxQfNh11QwTtkYpcs=
kmodules.xyz/crd-schema-fuzz v0.29.1/go.mod h1:n708z9YQqLMP2KNLQVgBcRJw1QpSWLvpNCEi+KJDOYE=
kmodules.xyz/custom-resources v0.29.0 h1:RaDM2+wSVXiwIvLqmkTVYpwoH83AC8wruXe2p2rOZNY=
kmodules.xyz/custom-resources v0.29.0/go.mod h1:MzZyXtxdg1PDxGk3RTTO1Xv3KiVqZnIonSwmxVbagOY=
kmodules.xyz/monitoring-agent-api v0.29.0 h1:gpFl6OZrlMLb/ySMHdREI9EwGtnJ91oZBn9H1UFRwB4=
Expand Down
10 changes: 9 additions & 1 deletion vendor/kmodules.xyz/crd-schema-fuzz/fuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package crdfuzz
import (
"math/rand"
"os"
"strings"
"testing"

"github.com/google/go-cmp/cmp"
Expand Down Expand Up @@ -57,7 +58,14 @@ func SchemaFuzzTestForObject(t *testing.T, scheme *runtime.Scheme, obj runtime.O
t.Fatalf("Failed to convert type to `runtime.Unstructured`: %v", err)
return
}
structuralpruning.Prune(pruned, schema, true)
unknownFieldPaths := structuralpruning.PruneWithOptions(obj, schema, true, structuralschema.UnknownFieldPathOptions{
TrackUnknownFieldPaths: true,
ParentPath: nil,
UnknownFieldPaths: nil,
})
if len(unknownFieldPaths) > 0 {
t.Fatalf("unknownFieldPaths: %s", strings.Join(unknownFieldPaths, ","))
}
if !cmp.Equal(unstructuredFuzzed, pruned, cmp.Transformer("ObjectMeta", func(m map[string]interface{}) map[string]interface{} {
if m["creationTimestamp"] == nil {
delete(m, "creationTimestamp")
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ kmodules.xyz/client-go/meta
kmodules.xyz/client-go/openapi
kmodules.xyz/client-go/policy/secomp
kmodules.xyz/client-go/tools/clusterid
# kmodules.xyz/crd-schema-fuzz v0.29.0
# kmodules.xyz/crd-schema-fuzz v0.29.1
## explicit; go 1.21.5
kmodules.xyz/crd-schema-fuzz
# kmodules.xyz/custom-resources v0.29.0
Expand Down

0 comments on commit 9853d93

Please sign in to comment.