Skip to content

Commit

Permalink
fix make targets
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Dec 6, 2023
1 parent 126c7b4 commit 8433e68
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 36 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ generate-e2e-templates-main: $(KUSTOMIZE) ## Generate test templates for the mai
.PHONY: lint
lint: $(GOLANGCI_LINT) ## Lint the codebase
$(GOLANGCI_LINT) run -v $(GOLANGCI_LINT_EXTRA_ARGS)
cd $(TEST_DIR); $(GOLANGCI_LINT) run --path-prefix $(TEST_DIR) --config $(ROOT_DIR)/.golangci.yml -v $(GOLANGCI_LINT_EXTRA_ARGS)

.PHONY: lint-fix
lint-fix: $(GOLANGCI_LINT) ## Lint the codebase and run auto-fixers if supported by the linter
Expand All @@ -342,7 +343,7 @@ verify: $(addprefix verify-,$(ALL_VERIFY_CHECKS)) ## Run all verify-* targets

.PHONY: verify-modules
verify-modules: generate-modules ## Verify go modules are up to date
@if !(git diff --quiet HEAD -- go.sum go.mod); then \
@if !(git diff --quiet HEAD -- go.sum go.mod $(TEST_DIR)/go.mod $(TEST_DIR)/go.sum); then \
git diff; \
echo "go module files are out of date"; exit 1; \
fi
Expand Down Expand Up @@ -387,7 +388,11 @@ verify-licenses: ## Verify licenses

.PHONY: verify-govulncheck
verify-govulncheck: $(GOVULNCHECK) ## Verify code for vulnerabilities
$(GOVULNCHECK) ./...
$(GOVULNCHECK) ./... && R1=$$? || R1=$$?; \
$(GOVULNCHECK) -C "$(TEST_DIR)" ./... && R2=$$? || R2=$$?; \
if [ "$$R1" -ne "0" ] || [ "$$R2" -ne "0" ]; then \
exit 1; \
fi

.PHONY: verify-security
verify-security: ## Verify code and images for vulnerabilities
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/vmware/govmomi"
"github.com/vmware/govmomi/find"
"github.com/vmware/govmomi/vapi/rest"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/cluster-api/test/framework"
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
)
Expand Down Expand Up @@ -62,8 +62,8 @@ func defaultConfigCluster(clusterName, namespace, flavor string, controlPlaneNod
Namespace: namespace,
ClusterName: clusterName,
KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion),
ControlPlaneMachineCount: pointer.Int64(controlPlaneNodeCount),
WorkerMachineCount: pointer.Int64(workerNodeCount),
ControlPlaneMachineCount: ptr.To(controlPlaneNodeCount),
WorkerMachineCount: ptr.To(workerNodeCount),
}
if flavor != "" {
configClusterInput.Flavor = flavor
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/dhcp_overrides_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/vmware/govmomi/vim25/mo"
"gopkg.in/yaml.v2"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
"sigs.k8s.io/cluster-api/util"

Expand Down Expand Up @@ -79,8 +79,8 @@ var _ = Describe("DHCPOverrides configuration test", func() {
Namespace: namespace.Name,
ClusterName: clusterName,
KubernetesVersion: e2eConfig.GetVariable(KubernetesVersion),
ControlPlaneMachineCount: pointer.Int64(1),
WorkerMachineCount: pointer.Int64(1),
ControlPlaneMachineCount: ptr.To(int64(1)),
WorkerMachineCount: ptr.To(int64(1)),
},
WaitForClusterIntervals: e2eConfig.GetIntervals(specName, "wait-cluster"),
WaitForControlPlaneIntervals: e2eConfig.GetIntervals(specName, "wait-control-plane"),
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
capiutil "sigs.k8s.io/cluster-api/util"

infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
"sigs.k8s.io/cluster-api-provider-vsphere/test/framework"
helpers "sigs.k8s.io/cluster-api-provider-vsphere/test/framework"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/gpu_pci_passthrough_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/vmware/govmomi/find"
"github.com/vmware/govmomi/vim25/types"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
capiutil "sigs.k8s.io/cluster-api/util"
Expand Down Expand Up @@ -55,8 +55,8 @@ var _ = Describe("Cluster creation with GPU devices as PCI passthrough [speciali
Namespace: namespace.Name,
ClusterName: clusterName,
KubernetesVersion: e2eConfig.GetVariable(KubernetesVersion),
ControlPlaneMachineCount: pointer.Int64(1),
WorkerMachineCount: pointer.Int64(1),
ControlPlaneMachineCount: ptr.To(int64(1)),
WorkerMachineCount: ptr.To(int64(1)),
},
WaitForClusterIntervals: e2eConfig.GetIntervals("", "wait-cluster"),
WaitForControlPlaneIntervals: e2eConfig.GetIntervals("", "wait-control-plane"),
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/multivc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"

infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
"sigs.k8s.io/cluster-api-provider-vsphere/test/framework"
helpers "sigs.k8s.io/cluster-api-provider-vsphere/test/framework"
)

type MultiVCenterSpecInput struct {
Expand Down
12 changes: 6 additions & 6 deletions test/e2e/ownerreference_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1"
Expand All @@ -54,7 +54,7 @@ var _ = Describe("OwnerReference checks with FailureDomains and ClusterIdentity"
BootstrapClusterProxy: bootstrapClusterProxy,
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
Flavor: pointer.String("ownerreferences"),
Flavor: ptr.To("ownerreferences"),
PostMachinesProvisioned: func(proxy framework.ClusterProxy, namespace, clusterName string) {
// Inject a client to use for checkClusterIdentitySecretOwnerRef
checkClusterIdentitySecretOwnerRef(ctx, proxy.GetClient())
Expand Down Expand Up @@ -157,15 +157,15 @@ var (
// CAPI owners.
clusterClassOwner = metav1.OwnerReference{Kind: "ClusterClass", APIVersion: clusterv1.GroupVersion.String()}
clusterOwner = metav1.OwnerReference{Kind: "Cluster", APIVersion: clusterv1.GroupVersion.String()}
clusterController = metav1.OwnerReference{Kind: "Cluster", APIVersion: clusterv1.GroupVersion.String(), Controller: pointer.Bool(true)}
machineController = metav1.OwnerReference{Kind: "Machine", APIVersion: clusterv1.GroupVersion.String(), Controller: pointer.Bool(true)}
clusterController = metav1.OwnerReference{Kind: "Cluster", APIVersion: clusterv1.GroupVersion.String(), Controller: ptr.To(true)}
machineController = metav1.OwnerReference{Kind: "Machine", APIVersion: clusterv1.GroupVersion.String(), Controller: ptr.To(true)}
clusterResourceSetOwner = metav1.OwnerReference{Kind: "ClusterResourceSet", APIVersion: addonsv1.GroupVersion.String()}

// KCP owner.
kubeadmControlPlaneController = metav1.OwnerReference{Kind: "KubeadmControlPlane", APIVersion: controlplanev1.GroupVersion.String(), Controller: pointer.Bool(true)}
kubeadmControlPlaneController = metav1.OwnerReference{Kind: "KubeadmControlPlane", APIVersion: controlplanev1.GroupVersion.String(), Controller: ptr.To(true)}

// CAPBK owner.
kubeadmConfigController = metav1.OwnerReference{Kind: "KubeadmConfig", APIVersion: bootstrapv1.GroupVersion.String(), Controller: pointer.Bool(true)}
kubeadmConfigController = metav1.OwnerReference{Kind: "KubeadmConfig", APIVersion: bootstrapv1.GroupVersion.String(), Controller: ptr.To(true)}
)

// The following names are hardcoded in templates to make cleanup easier.
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/quick_start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package e2e

import (
. "github.com/onsi/ginkgo/v2"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
capi_e2e "sigs.k8s.io/cluster-api/test/e2e"
)

Expand All @@ -42,7 +42,7 @@ var _ = Describe("ClusterClass Creation using Cluster API quick-start test [PR-B
BootstrapClusterProxy: bootstrapClusterProxy,
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
Flavor: pointer.String("topology"),
Flavor: ptr.To("topology"),
}
})
})
Expand All @@ -55,7 +55,7 @@ var _ = Describe("Cluster creation with [Ignition] bootstrap [PR-Blocking]", fun
BootstrapClusterProxy: bootstrapClusterProxy,
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
Flavor: pointer.String("ignition"),
Flavor: ptr.To("ignition"),
}
})
})
4 changes: 2 additions & 2 deletions test/e2e/storage_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/vmware/govmomi/pbm"
"github.com/vmware/govmomi/pbm/types"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
"sigs.k8s.io/cluster-api/util"
Expand Down Expand Up @@ -124,7 +124,7 @@ func VerifyStoragePolicy(ctx context.Context, input StoragePolicySpecInput) {
By("verifying storage policy is used by VMs")
for _, vm := range vms.Items {
si := object.NewSearchIndex(input.Client.Client)
ref, err := si.FindByUuid(ctx, datacenter, vm.Spec.BiosUUID, true, pointer.Bool(false))
ref, err := si.FindByUuid(ctx, datacenter, vm.Spec.BiosUUID, true, ptr.To(false))
Expect(err).NotTo(HaveOccurred())
found := false

Expand Down
3 changes: 2 additions & 1 deletion test/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package helpers
// Package framework implements utils for CAPV e2e tests.
package framework

import (
"context"
Expand Down
10 changes: 5 additions & 5 deletions test/integration/cluster_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
. "github.com/onsi/ginkgo/v2"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)

// The purpose of this test is to start up a CAPI controller against a real API
Expand Down Expand Up @@ -79,8 +79,8 @@ var _ = Describe("Cluster lifecycle tests", func() {
// Cluster.
cluster := assertEventuallyExists(clustersResource, mf.ClusterComponents.Cluster.Name, testNamespace, nil)
clusterOwnerRef := toOwnerRef(cluster)
clusterOwnerRef.Controller = pointer.Bool(true)
clusterOwnerRef.BlockOwnerDeletion = pointer.Bool(true)
clusterOwnerRef.Controller = ptr.To(true)
clusterOwnerRef.BlockOwnerDeletion = ptr.To(true)
assertEventuallyExists(vsphereclustersResource, mf.ClusterComponents.Cluster.Name, testNamespace, clusterOwnerRef)
})

Expand Down Expand Up @@ -124,8 +124,8 @@ var _ = Describe("Cluster lifecycle tests", func() {
// controller OwnerRef that points to the VSphereMachine.
machine := assertEventuallyExists(machinesResource, controlPlane.Machine.Name, testNamespace, nil)
machineOwnerRef := toOwnerRef(machine)
machineOwnerRef.Controller = pointer.Bool(true)
machineOwnerRef.BlockOwnerDeletion = pointer.Bool(true)
machineOwnerRef.Controller = ptr.To(true)
machineOwnerRef.BlockOwnerDeletion = ptr.To(true)
assertEventuallyExists(kubeadmconfigResources, controlPlane.Machine.Name, testNamespace, machineOwnerRef)

assertEventuallyExists(virtualmachinesResource, controlPlane.Machine.Name, testNamespace, nil)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/integration_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"

vmwarev1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/vmware/v1beta1"
"sigs.k8s.io/cluster-api-provider-vsphere/test/framework"
helpers "sigs.k8s.io/cluster-api-provider-vsphere/test/framework"
)

const (
Expand Down
10 changes: 5 additions & 5 deletions test/integration/sanity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
vmoprv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"

vmwarev1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/vmware/v1beta1"
Expand Down Expand Up @@ -70,8 +70,8 @@ var _ = Describe("Sanity tests", func() {
// and that the VSphereCluster has an OwnerRef that points to the CAPI Cluster.
cluster := assertEventuallyExists(clustersResource, mf.ClusterComponents.Cluster.Name, mf.ClusterComponents.Cluster.Namespace, nil)
clusterOwnerRef := toOwnerRef(cluster)
clusterOwnerRef.Controller = pointer.Bool(true)
clusterOwnerRef.BlockOwnerDeletion = pointer.Bool(true)
clusterOwnerRef.Controller = ptr.To(true)
clusterOwnerRef.BlockOwnerDeletion = ptr.To(true)
assertEventuallyExists(vsphereclustersResource, mf.ClusterComponents.Cluster.Name, mf.ClusterComponents.Cluster.Namespace, clusterOwnerRef)

// CREATE the CAPI Machine, VSphereMachine, and KubeadmConfig resources for
Expand All @@ -86,8 +86,8 @@ var _ = Describe("Sanity tests", func() {
// the CAPI Machine.
machine := assertEventuallyExists(machinesResource, controlPlane.Machine.Name, controlPlane.Machine.Namespace, nil)
machineOwnerRef := toOwnerRef(machine)
machineOwnerRef.Controller = pointer.Bool(true)
machineOwnerRef.BlockOwnerDeletion = pointer.Bool(true)
machineOwnerRef.Controller = ptr.To(true)
machineOwnerRef.BlockOwnerDeletion = ptr.To(true)
assertEventuallyExists(vspheremachinesResource, controlPlane.Machine.Name, controlPlane.Machine.Namespace, machineOwnerRef)
assertEventuallyExists(kubeadmconfigResources, controlPlane.Machine.Name, controlPlane.Machine.Namespace, machineOwnerRef)
})
Expand Down

0 comments on commit 8433e68

Please sign in to comment.