Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed May 13, 2024
1 parent b0fbc69 commit 02acd8f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions controllers/serviceaccount_controller_intg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
helpers "sigs.k8s.io/cluster-api-provider-vsphere/internal/test/helpers/vmware"
)

var _ = Describe("ProviderServiceAccount controller integration tests", Label("FOO"), func() {
var _ = Describe("ProviderServiceAccount controller integration tests", func() {
var intCtx *helpers.IntegrationTestContext

BeforeEach(func() {
Expand Down Expand Up @@ -131,7 +131,7 @@ var _ = Describe("ProviderServiceAccount controller integration tests", Label("F
})
})

Context("With non-existent Cluster object", Label("FOO"), func() {
Context("With non-existent Cluster object", func() {
It("cannot reconcile the ProviderServiceAccount object", func() {
By("Creating the vSphereCluster and KubeconfigSecret only", func() {
helpers.CreateAndWait(ctx, intCtx.Client, intCtx.VSphereCluster)
Expand Down
20 changes: 10 additions & 10 deletions internal/test/helpers/vmware/intg_test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func NewIntegrationTestContextWithClusters(ctx context.Context, integrationTestC
})

vsphereClusterName := capiutil.RandomString(6)
testCtx.Cluster = createCluster(testCtx.Namespace, vsphereClusterName)
testCtx.Cluster = generateCluster(testCtx.Namespace, vsphereClusterName)

var config *rest.Config

Expand All @@ -127,8 +127,8 @@ func NewIntegrationTestContextWithClusters(ctx context.Context, integrationTestC

testCtx.envTest = envTest
})
By("Create the kubeconfig secret for the cluster", func() {
buf, err := writeKubeConfig(config)
By("Generating the kubeconfig secret for the cluster", func() {
buf, err := generateKubeConfig(config)
Expect(err).ToNot(HaveOccurred())
secret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -151,8 +151,8 @@ func NewIntegrationTestContextWithClusters(ctx context.Context, integrationTestC
testCtx.KubeconfigSecret = secret
})

By("Create a vsphere cluster and wait for it to exist", func() {
testCtx.VSphereCluster = createVSphereCluster(testCtx.Namespace, vsphereClusterName, testCtx.Cluster.GetName())
By("Generating a vsphere cluster", func() {
testCtx.VSphereCluster = generateVSphereCluster(testCtx.Namespace, vsphereClusterName, testCtx.Cluster.GetName())
testCtx.VSphereClusterKey = client.ObjectKeyFromObject(testCtx.VSphereCluster)
})

Expand All @@ -168,8 +168,8 @@ func CreateAndWait(ctx context.Context, integrationTestClient client.Client, obj
}).Should(Succeed())
}

func createCluster(namespace, name string) *clusterv1.Cluster {
By("Create the CAPI Cluster and wait for it to exist")
func generateCluster(namespace, name string) *clusterv1.Cluster {
By("Generate the CAPI Cluster")
cluster := &clusterv1.Cluster{
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Expand All @@ -193,7 +193,7 @@ func createCluster(namespace, name string) *clusterv1.Cluster {
return cluster
}

func createVSphereCluster(namespace, name, capiClusterName string) *vmwarev1.VSphereCluster {
func generateVSphereCluster(namespace, name, capiClusterName string) *vmwarev1.VSphereCluster {
vsphereCluster := &vmwarev1.VSphereCluster{
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Expand All @@ -204,8 +204,8 @@ func createVSphereCluster(namespace, name, capiClusterName string) *vmwarev1.VSp
return vsphereCluster
}

// writeKubeConfig writes an existing *rest.Config out as the typical kubeconfig YAML data.
func writeKubeConfig(config *rest.Config) ([]byte, error) {
// generateKubeConfig writes an existing *rest.Config out as the typical kubeconfig YAML data.
func generateKubeConfig(config *rest.Config) ([]byte, error) {
return clientcmd.Write(api.Config{
Clusters: map[string]*api.Cluster{
config.ServerName: {
Expand Down

0 comments on commit 02acd8f

Please sign in to comment.