Skip to content

Commit

Permalink
register all types needed for test
Browse files Browse the repository at this point in the history
  • Loading branch information
jm96441n committed Feb 14, 2024
1 parent 0b438fd commit 9af7507
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion control-plane/api/mesh/v2beta1/api_gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const (
)

func init() {
MeshSchemeBuilder.Register(&GatewayClass{}, &GatewayClassList{}, &APIGateway{}, &APIGatewayList{})
MeshSchemeBuilder.Register(&APIGateway{}, &APIGatewayList{})
}

// +kubebuilder:object:root=true
Expand Down
20 changes: 16 additions & 4 deletions control-plane/controllers/resources/api-gateway-controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import (
"google.golang.org/protobuf/testing/protocmp"

logrtest "github.com/go-logr/logr/testr"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand All @@ -31,10 +34,19 @@ func TestAPIGatewayController_ReconcileResourceExists(t *testing.T) {
ctx := context.Background()

s := runtime.NewScheme()
s.AddKnownTypes(schema.GroupVersion{
Group: "mesh.consul.hashicorp.com",
Version: pbmesh.Version,
}, &v2beta1.APIGateway{}, &v2beta1.APIGatewayList{})
require.NoError(t, corev1.AddToScheme(s))
require.NoError(t, appsv1.AddToScheme(s))
require.NoError(t, rbacv1.AddToScheme(s))
require.NoError(t, v2beta1.AddMeshToScheme(s))
s.AddKnownTypes(
schema.GroupVersion{
Group: "mesh.consul.hashicorp.com",
Version: pbmesh.Version,
},
&v2beta1.APIGateway{},
&v2beta1.GatewayClass{},
&v2beta1.GatewayClassConfig{},
)

apiGW := &v2beta1.APIGateway{
ObjectMeta: metav1.ObjectMeta{
Expand Down

0 comments on commit 9af7507

Please sign in to comment.