Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
e2e: fixup imports and CRD types
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemorris committed Jun 1, 2022
1 parent 020fdf4 commit 415af3f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions internal/commands/server/k8s_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ func TestRouteParentRefChange(t *testing.T) {
},
Spec: gateway.HTTPRouteSpec{
CommonRouteSpec: gateway.CommonRouteSpec{
ParentRefs: []gateway.ParentRef{{
ParentRefs: []gateway.ParentReference{{
Name: gateway.ObjectName(firstGatewayName),
}},
},
Expand Down Expand Up @@ -1351,7 +1351,7 @@ func TestRouteParentRefChange(t *testing.T) {

// Update httpRoute from remote, then switch ParentRef
require.NoError(t, resources.Get(ctx, httpRouteName, namespace, httpRoute))
httpRoute.Spec.CommonRouteSpec.ParentRefs = []gateway.ParentRef{{
httpRoute.Spec.CommonRouteSpec.ParentRefs = []gateway.ParentReference{{
Name: gateway.ObjectName(secondGatewayName),
Namespace: &gwNamespace,
}}
Expand Down
4 changes: 2 additions & 2 deletions internal/testing/e2e/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"time"

"golang.org/x/sync/errgroup"
api "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/client-go/kubernetes/scheme"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/e2e-framework/pkg/env"
"sigs.k8s.io/e2e-framework/pkg/envconf"
Expand Down Expand Up @@ -159,7 +159,7 @@ func DestroyTestGatewayServer(ctx context.Context, cfg *envconf.Config) (context
func InstallConsulAPIGatewayCRDs(ctx context.Context, cfg *envconf.Config) (context.Context, error) {
directory := path.Join("..", "..", "..", "config", "crd", "bases")
entries, err := os.ReadDir(directory)
crds := []client.Object{}
crds := []api.CustomResourceDefinition{}
if err != nil {
return nil, err
}
Expand Down
7 changes: 3 additions & 4 deletions internal/testing/e2e/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"k8s.io/apimachinery/pkg/util/yaml"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/e2e-framework/klient"
"sigs.k8s.io/e2e-framework/pkg/env"
Expand Down Expand Up @@ -226,9 +225,9 @@ func serviceClusterRoleAuthBinding(namespace, accountName string) *rbac.ClusterR
}
}

func readCRDs(data []byte) ([]client.Object, error) {
func readCRDs(data []byte) ([]api.CustomResourceDefinition, error) {
decoder := yaml.NewYAMLOrJSONDecoder(bytes.NewReader(data), len(data))
crds := []client.Object{}
crds := []api.CustomResourceDefinition{}
for {
crd := &api.CustomResourceDefinition{}
err := decoder.Decode(crd)
Expand All @@ -239,7 +238,7 @@ func readCRDs(data []byte) ([]client.Object, error) {
return nil, err
}
if crd.Name != "" {
crds = append(crds, crd)
crds = append(crds, *crd)
}
}
return crds, nil
Expand Down
4 changes: 2 additions & 2 deletions internal/testing/e2e/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"os/exec"
"time"

"sigs.k8s.io/controller-runtime/pkg/client"
api "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
)

func kubectlKustomizeCRDs(ctx context.Context, url string) ([]client.Object, error) {
func kubectlKustomizeCRDs(ctx context.Context, url string) ([]api.CustomResourceDefinition, error) {
var stdout, stderr bytes.Buffer
timeoutContext, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
Expand Down

0 comments on commit 415af3f

Please sign in to comment.