Skip to content

Commit 7d7fc6c

Browse files
committed
Add fuzzy conversion tests for v1alpha6
As there are no API differences yet between v1alpha6 and v1alpha7, no special fuzzers are needed. The tests check hub-spoke-hub and spoke-hub-spoke conversions.
1 parent 5e1d016 commit 7d7fc6c

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

api/v1alpha6/conversion_test.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
Copyright 2023 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha6
18+
19+
import (
20+
"testing"
21+
22+
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
23+
24+
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7"
25+
)
26+
27+
func TestFuzzyConversion(t *testing.T) {
28+
t.Run("for OpenStackCluster", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
29+
Hub: &infrav1.OpenStackCluster{},
30+
Spoke: &OpenStackCluster{},
31+
}))
32+
33+
t.Run("for OpenStackClusterTemplate", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
34+
Hub: &infrav1.OpenStackClusterTemplate{},
35+
Spoke: &OpenStackClusterTemplate{},
36+
}))
37+
38+
t.Run("for OpenStackMachine", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
39+
Hub: &infrav1.OpenStackMachine{},
40+
Spoke: &OpenStackMachine{},
41+
}))
42+
43+
t.Run("for OpenStackMachineTemplate", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
44+
Hub: &infrav1.OpenStackMachineTemplate{},
45+
Spoke: &OpenStackMachineTemplate{},
46+
}))
47+
}

0 commit comments

Comments
 (0)