Skip to content

Commit

Permalink
test api serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Jul 25, 2024
1 parent ad97dc5 commit db71a08
Show file tree
Hide file tree
Showing 2 changed files with 841 additions and 0 deletions.
47 changes: 47 additions & 0 deletions test/extension/handlers/topologymutation/serialization_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package topologymutation

import (
"testing"

. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"

infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1beta1"
apiquality "sigs.k8s.io/cluster-api/util/api"
)

func TestSerialization(t *testing.T) {
g := NewWithT(t)

var apiType runtime.Object = &infrav1.DockerClusterTemplate{
TypeMeta: metav1.TypeMeta{
Kind: "DockerClusterTemplate",
APIVersion: infrav1.GroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: "test-serialization",
},
}

err := apiquality.NewSerializationTester().
FillAndTest(testScheme, apiType, "../../../infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclustertemplates.yaml")

g.Expect(err).ToNot(HaveOccurred())
}
Loading

0 comments on commit db71a08

Please sign in to comment.