Skip to content

Commit

Permalink
Add Node IPAM e2e test
Browse files Browse the repository at this point in the history
- converted to ginkgo/v2
- added the following e2e config fields for ipam e2e test:
  - NODE_IPAM_POOL_SUBNET
  - NODE_IPAM_POOL_GATEWAY
  - NODE_IPAM_POOL_START
  - NODE_IPAM_POOL_END
  - NODE_IPAM_NAMESERVER

Co-authored-by: Aidan Obley <[email protected]>
Co-authored-by: Christian Ang <[email protected]>
Co-authored-by: Tyler Schultz <[email protected]>
Co-authored-by: Edwin Xie <[email protected]>
  • Loading branch information
4 people committed Nov 3, 2022
1 parent 8e11add commit 8324d46
Show file tree
Hide file tree
Showing 62 changed files with 325 additions and 274 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ test/e2e/data/infrastructure-vsphere/cluster-template-md-remediation.yaml
test/e2e/data/infrastructure-vsphere/cluster-template-node-drain.yaml
test/e2e/data/infrastructure-vsphere/cluster-template-pci.yaml
test/e2e/data/infrastructure-vsphere/cluster-template-topology.yaml
test/e2e/data/infrastructure-vsphere/cluster-template-ipam.yaml
test/e2e/data/infrastructure-vsphere/clusterclass-quick-start.yaml
_artifacts/

Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ e2e-templates: ## Generate e2e cluster templates
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build $(E2E_TEMPLATE_DIR)/kustomization/topology > $(E2E_TEMPLATE_DIR)/cluster-template-topology.yaml
# for PCI passthrough template
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build $(E2E_TEMPLATE_DIR)/kustomization/pci > $(E2E_TEMPLATE_DIR)/cluster-template-pci.yaml
# for IPAM template
"$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build $(E2E_TEMPLATE_DIR)/kustomization/ipam > $(E2E_TEMPLATE_DIR)/cluster-template-ipam.yaml

.PHONY: test-integration
test-integration: e2e-image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ spec:
description: APIGroups is the name of the APIGroup that contains
the resources. If multiple API groups are specified, any
action requested against one of the enumerated resources in
any API group will be allowed.
any API group will be allowed. "" represents the core API
group and "*" represents all API groups.
items:
type: string
type: array
Expand Down
7 changes: 2 additions & 5 deletions controllers/controllers_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ import (
"os"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/kubernetes/scheme"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"

infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
vmwarev1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/vmware/v1beta1"
Expand All @@ -39,9 +38,7 @@ import (

func TestControllers(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecsWithDefaultAndCustomReporters(t,
"Controller Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Controller Suite")
}

var (
Expand Down
2 changes: 1 addition & 1 deletion controllers/serviceaccount_controller_intg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"os"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion controllers/serviceaccount_controller_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"os"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
capiutil "sigs.k8s.io/cluster-api/util"
Expand Down
2 changes: 1 addition & 1 deletion controllers/svcdiscovery_controller_intg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package controllers

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
2 changes: 1 addition & 1 deletion controllers/svcdiscovery_controller_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package controllers

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
bootstrapapi "k8s.io/cluster-bootstrap/token/api"
Expand Down
9 changes: 3 additions & 6 deletions controllers/vmware/test/controllers_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"testing"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/kubernetes/scheme"
Expand All @@ -39,7 +39,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
logf "sigs.k8s.io/controller-runtime/pkg/log"
ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager"

Expand Down Expand Up @@ -67,9 +66,7 @@ func init() {
func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)

RunSpecsWithDefaultAndCustomReporters(t,
"VMware Controllers Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "VMware Controllers Suite")
}

// TODO: can't call RunSpecs twice. Need to parameterize this externally and call the test suite twice
Expand Down Expand Up @@ -162,7 +159,7 @@ var _ = BeforeSuite(func() {
go func() {
Expect(mgr.Start(ctx)).ToNot(HaveOccurred())
}()
}, 60)
})

var _ = AfterSuite(func() {
By("tearing down the test environments")
Expand Down
2 changes: 1 addition & 1 deletion controllers/vmware/test/controllers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"reflect"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
vmoprv1 "github.com/vmware-tanzu/vm-operator-api/api/v1alpha1"
corev1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion controllers/vmware/vspherecluster_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package vmware
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
topologyv1 "github.com/vmware-tanzu/vm-operator/external/tanzu-topology/api/v1alpha1"
corev1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion controllers/vspherecluster_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"testing"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/vmware/govmomi/simulator"
corev1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion controllers/vsphereclusteridentity_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package controllers
import (
goctx "context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
2 changes: 1 addition & 1 deletion controllers/vspheredeploymentzone_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"testing"

"github.com/go-logr/logr"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/vmware/govmomi/simulator"
Expand Down
2 changes: 1 addition & 1 deletion controllers/vspheremachine_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package controllers

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
45 changes: 21 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ require (
github.com/google/gofuzz v1.2.0
github.com/google/uuid v1.3.0
github.com/hashicorp/go-version v1.3.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.20.0
github.com/onsi/ginkgo/v2 v2.2.0
github.com/onsi/gomega v1.20.1
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.5.0
github.com/stretchr/testify v1.8.0
Expand All @@ -21,24 +21,25 @@ require (
golang.org/x/crypto v0.0.0-20220817201139-bc19a97f63c8
golang.org/x/exp v0.0.0-20221002003631-540bb7301a08
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4
golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1
gopkg.in/gcfg.v1 v1.2.3
k8s.io/api v0.24.4
k8s.io/apiextensions-apiserver v0.24.4
k8s.io/apimachinery v0.24.4
k8s.io/client-go v0.24.4
k8s.io/cluster-bootstrap v0.24.4
k8s.io/component-base v0.24.4
k8s.io/klog/v2 v2.70.1
k8s.io/utils v0.0.0-20220812165043-ad590609e2e5
sigs.k8s.io/cluster-api v1.2.2
sigs.k8s.io/cluster-api/test v1.2.2
sigs.k8s.io/controller-runtime v0.12.3
sigs.k8s.io/kind v0.14.0
k8s.io/api v0.25.0
k8s.io/apiextensions-apiserver v0.25.0
k8s.io/apimachinery v0.25.0
k8s.io/client-go v0.25.0
k8s.io/cluster-bootstrap v0.25.0
k8s.io/component-base v0.25.0
k8s.io/klog/v2 v2.80.1
k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73
sigs.k8s.io/cluster-api v1.2.0-beta.0.0.20221012201901-601691efca60
sigs.k8s.io/cluster-api/test v1.2.0-beta.0.0.20221012201901-601691efca60
sigs.k8s.io/controller-runtime v0.13.0
sigs.k8s.io/kind v0.16.0
sigs.k8s.io/yaml v1.3.0
)

require (
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/go-logr/zapr v1.2.3 // indirect
github.com/google/gnostic v0.6.9 // indirect
Expand All @@ -51,8 +52,6 @@ require (
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.22.0 // indirect
go4.org/intern v0.0.0-20220617035311-6925f38cc365 // indirect
inet.af/netaddr v0.0.0-20220811202034-502d2d690317 // indirect
)

require (
Expand Down Expand Up @@ -82,12 +81,12 @@ require (
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gobuffalo/flect v0.2.5 // indirect
github.com/gobuffalo/flect v0.3.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/cel-go v0.12.5 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
Expand All @@ -104,7 +103,6 @@ require (
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
Expand All @@ -122,8 +120,8 @@ require (
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/subosito/gotenv v1.3.0 // indirect
github.com/valyala/fastjson v1.6.3 // indirect
golang.org/x/net v0.0.0-20220812174116-3211cb980234 // indirect
golang.org/x/sys v0.0.0-20220818161305-2296e01440c6 // indirect
golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
golang.org/x/text v0.3.7
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
Expand All @@ -134,11 +132,10 @@ require (
gopkg.in/fsnotify.v1 v1.4.7
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiserver v0.24.4 // indirect
k8s.io/apiserver v0.25.0 // indirect
k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
Expand Down
Loading

0 comments on commit 8324d46

Please sign in to comment.