kubernetes-sigs / cluster-api-provider-openstack

Cluster API implementation for OpenStack

Home Page:https://cluster-api-openstack.sigs.k8s.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fuzzer tests occasionally generate invalid filters

mdbooth opened this issue · comments

/kind bug

An example test failure:

=== NAME  TestFuzzyConversion/for_OpenStackMachineTemplate/hub-spoke-hub
    conversion.go:241: 
          &v1beta1.OpenStackMachineTemplate{
          	TypeMeta:   {},
          	ObjectMeta: {Name: "M妮Ű啔p", GenerateName: "ǚĮ贵ɚëb蕡开鯺", Namespace: `葇蕊ÞGf"%!Ǻ(MISSING)`, SelfLink: "X濂R`Ÿ蒴ǩ嵅ǝ¤ıǯʊ-絵", ...},
          	Spec: v1beta1.OpenStackMachineTemplateSpec{
          		Template: v1beta1.OpenStackMachineTemplateResource{
          			Spec: v1beta1.OpenStackMachineSpec{
          				... // 4 identical fields
          				SSHKeyName: "Éǻ澔o阭疬#SǭY6",
          				Ports:      nil,
          				SecurityGroups: []v1beta1.SecurityGroupParam{
          					{
          						ID: nil,
        - 						Filter: &v1beta1.SecurityGroupFilter{
        - 							FilterByNeutronTags: v1beta1.FilterByNeutronTags{TagsAny: []v1beta1.NeutronTag{}, NotTags: []v1beta1.NeutronTag{""}},
        - 						},
        + 						Filter: nil,
          					},
          				},
          				Trunk:                  false,
          				Tags:                   nil,
          				ServerMetadata:         nil,
          				ConfigDrive:            nil,
          				RootVolume:             &{Size: 969537711, AvailabilityZone: "%!ɘ(MISSING).;µk戮ìCǯǜ徻湐ī±iǏ浯o"},
        - 				AdditionalBlockDevices: []v1beta1.AdditionalBlockDevice{},
        + 				AdditionalBlockDevices: nil,
          				ServerGroup:            &{ID: "ŰbßV穵逡¤{嬐ƼsƼƑ", Name: "@鏲TÑ泘孼Ëë]D:Ȏ"},
          				IdentityRef:            &{Name: "鑿_e嬹fǫĨȊ+[ïȿĝ2hĠǖ", CloudName: "綐肔"},
          				FloatingIPPoolRef:      nil,
          			},
          		},
          	},
          }
        
        Expected
            <bool>: false
        to be true

We can see here that the SecurityGroupFilter contains an empty tag. Tags in v1beta1 are defined not to be empty, and this is validated by the API, so we don't attempt to convert or restore empty tags correctly correctly.

Because this struct is generated by the fuzzer, the failure mode is non-deterministic.