Skip to content

Commit

Permalink
Build fixes to keep the build passing
Browse files Browse the repository at this point in the history
Changes to fix linting issues and version dependencies to keep the
build passing
  • Loading branch information
thunderboltsid committed May 10, 2024
1 parent 7bab2a6 commit 0b7ad5d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 29 deletions.
19 changes: 9 additions & 10 deletions test/e2e/cluster_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,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 @@ -46,7 +45,7 @@ var _ = Describe("When upgrading a workload cluster and testing K8S conformance"
// BootstrapClusterProxy: bootstrapClusterProxy,
// ArtifactFolder: artifactFolder,
// SkipCleanup: skipCleanup,
// Flavor: pointer.String("topology"),
// Flavor: ptr.To("topology"),
// // This test is run in CI in parallel with other tests. To keep the test duration reasonable
// // the conformance tests are skipped.
// SkipConformanceTests: true,
Expand All @@ -65,8 +64,8 @@ var _ = Describe("When upgrading a workload cluster with a single control plane
// This test is run in CI in parallel with other tests. To keep the test duration reasonable
// the conformance tests are skipped.
SkipConformanceTests: true,
ControlPlaneMachineCount: pointer.Int64(1),
WorkerMachineCount: pointer.Int64(1),
ControlPlaneMachineCount: ptr.To(int64(1)),
WorkerMachineCount: ptr.To(int64(1)),
}
})
})
Expand All @@ -82,8 +81,8 @@ var _ = Describe("When upgrading a workload cluster with a HA control plane", La
// This test is run in CI in parallel with other tests. To keep the test duration reasonable
// the conformance tests are skipped.
SkipConformanceTests: true,
ControlPlaneMachineCount: pointer.Int64(3),
WorkerMachineCount: pointer.Int64(1),
ControlPlaneMachineCount: ptr.To(int64(3)),
WorkerMachineCount: ptr.To(int64(1)),
}
})
})
Expand All @@ -99,9 +98,9 @@ var _ = Describe("When upgrading a workload cluster with a HA control plane usin
// This test is run in CI in parallel with other tests. To keep the test duration reasonable
// the conformance tests are skipped.
SkipConformanceTests: true,
ControlPlaneMachineCount: pointer.Int64(3),
WorkerMachineCount: pointer.Int64(1),
Flavor: pointer.String("kcp-scale-in"),
ControlPlaneMachineCount: ptr.To(int64(3)),
WorkerMachineCount: ptr.To(int64(1)),
Flavor: ptr.To("kcp-scale-in"),
}
})
})
5 changes: 2 additions & 3 deletions test/e2e/clusterctl_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"bytes"
"context"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"time"
Expand Down Expand Up @@ -132,7 +131,7 @@ func createPreWaitForClusterFunc(testInputFunc func() capi_e2e.ClusterctlUpgrade
Byf("Replacing image in %s", latestVersionComponentsYamlFile)

// load the components.yaml file
componentsYaml, err := ioutil.ReadFile(latestVersionComponentsYamlFile)
componentsYaml, err := os.ReadFile(latestVersionComponentsYamlFile)
Expect(err).NotTo(HaveOccurred())

gitCommitHash := os.Getenv("GIT_COMMIT")
Expand All @@ -146,7 +145,7 @@ func createPreWaitForClusterFunc(testInputFunc func() capi_e2e.ClusterctlUpgrade
)

// write the file back
err = ioutil.WriteFile(latestVersionComponentsYamlFile, componentsYaml, 0o644)
err = os.WriteFile(latestVersionComponentsYamlFile, componentsYaml, 0o644)
Expect(err).NotTo(HaveOccurred())

Byf("Successfully replaced image in components.yaml with the image from the current commit: %s", currentCommitImage)
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/md_scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
capi_e2e "sigs.k8s.io/cluster-api/test/e2e"
"sigs.k8s.io/cluster-api/test/framework"
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
Expand Down Expand Up @@ -96,16 +96,16 @@ var _ = Describe("When testing MachineDeployment scale up/down from 10 replicas
Namespace: namespace.Name,
ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)),
KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion),
ControlPlaneMachineCount: pointer.Int64Ptr(1),
WorkerMachineCount: pointer.Int64Ptr(10),
ControlPlaneMachineCount: ptr.To(int64(1)),
WorkerMachineCount: ptr.To(int64(10)),
},
ControlPlaneWaiters: input.ControlPlaneWaiters,
WaitForClusterIntervals: input.E2EConfig.GetIntervals(specName, "wait-cluster"),
WaitForControlPlaneIntervals: input.E2EConfig.GetIntervals(specName, "wait-control-plane"),
WaitForMachineDeployments: input.E2EConfig.GetIntervals(specName, "wait-worker-nodes"),
}, clusterResources)

Expect(clusterResources.MachineDeployments[0].Spec.Replicas).To(Equal(pointer.Int32Ptr(10)))
Expect(clusterResources.MachineDeployments[0].Spec.Replicas).To(Equal(ptr.To(int32(10))))

By("Scaling the MachineDeployment out to 20")
framework.ScaleAndWaitMachineDeployment(ctx, framework.ScaleAndWaitMachineDeploymentInput{
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/projects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
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"

Expand Down Expand Up @@ -68,7 +68,7 @@ var _ = Describe("Nutanix projects", Label("capx-feature-test", "projects", "slo
invalidProjectNMT := testHelper.createDefaultNMT(clusterName, namespace.Name)
invalidProjectNMT.Spec.Template.Spec.Project = &infrav1.NutanixResourceIdentifier{
Type: "name",
Name: pointer.StringPtr(nonExistingProjectName),
Name: ptr.To(nonExistingProjectName),
}
testHelper.createCapiObject(ctx, createCapiObjectParams{
creator: bootstrapClusterProxy.GetClient(),
Expand Down
20 changes: 10 additions & 10 deletions test/e2e/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
capiv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/test/framework"
Expand Down Expand Up @@ -254,16 +254,16 @@ func (t testHelper) createUUIDNMT(ctx context.Context, clusterName, namespace st
MemorySize: resource.MustParse(defaultMemorySize),
Image: infrav1.NutanixResourceIdentifier{
Type: infrav1.NutanixIdentifierUUID,
UUID: pointer.StringPtr(imageUUID),
UUID: ptr.To(imageUUID),
},
Cluster: infrav1.NutanixResourceIdentifier{
Type: infrav1.NutanixIdentifierUUID,
UUID: pointer.StringPtr(clusterUUID),
UUID: ptr.To(clusterUUID),
},
Subnets: []infrav1.NutanixResourceIdentifier{
{
Type: infrav1.NutanixIdentifierUUID,
UUID: pointer.StringPtr(subnetUUID),
UUID: ptr.To(subnetUUID),
},
},
SystemDiskSize: resource.MustParse(defaultSystemDiskSize),
Expand Down Expand Up @@ -426,8 +426,8 @@ func (t testHelper) deployCluster(params deployClusterParams, clusterResources *
Namespace: params.namespace.Name,
ClusterName: params.clusterName,
KubernetesVersion: t.e2eConfig.GetVariable(KubernetesVersion),
ControlPlaneMachineCount: pointer.Int64Ptr(1),
WorkerMachineCount: pointer.Int64Ptr(1),
ControlPlaneMachineCount: ptr.To(int64(1)),
WorkerMachineCount: ptr.To(int64(1)),
}

t.createClusterFromConfig(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
Expand All @@ -449,8 +449,8 @@ func (t testHelper) deployClusterAndWait(params deployClusterParams, clusterReso
Namespace: params.namespace.Name,
ClusterName: params.clusterName,
KubernetesVersion: t.e2eConfig.GetVariable(KubernetesVersion),
ControlPlaneMachineCount: pointer.Int64Ptr(1),
WorkerMachineCount: pointer.Int64Ptr(1),
ControlPlaneMachineCount: ptr.To(int64(1)),
WorkerMachineCount: ptr.To(int64(1)),
}

clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
Expand Down Expand Up @@ -537,15 +537,15 @@ func (t testHelper) getNutanixResourceIdentifierFromEnv(envVarKey string) infrav
Expect(envVarValue).ToNot(BeEmpty(), "expected environment variable %s to be set", envVarKey)
return infrav1.NutanixResourceIdentifier{
Type: nameType,
Name: pointer.StringPtr(envVarValue),
Name: ptr.To(envVarValue),
}
}

func (t testHelper) getNutanixResourceIdentifierFromE2eConfig(variableKey string) infrav1.NutanixResourceIdentifier {
variableValue := t.getVariableFromE2eConfig(variableKey)
return infrav1.NutanixResourceIdentifier{
Type: nameType,
Name: pointer.StringPtr(variableValue),
Name: ptr.To(variableValue),
}
}

Expand Down

0 comments on commit 0b7ad5d

Please sign in to comment.