From cd0bbe840f79d39a9cb1ddcb37086163aac080d6 Mon Sep 17 00:00:00 2001 From: Alexander Hebel Date: Wed, 20 Mar 2024 09:57:51 +0100 Subject: [PATCH] Add unit test --- pkg/controller/worker/machines_test.go | 32 +++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/pkg/controller/worker/machines_test.go b/pkg/controller/worker/machines_test.go index 9e2f8c909..2b6473797 100644 --- a/pkg/controller/worker/machines_test.go +++ b/pkg/controller/worker/machines_test.go @@ -6,6 +6,7 @@ package worker_test import ( "context" + "encoding/json" "fmt" "path/filepath" "strings" @@ -141,6 +142,10 @@ var _ = Describe("Machines", func() { nodeTemplateZone3 machinev1alpha1.NodeTemplate nodeTemplateZone4 machinev1alpha1.NodeTemplate + diagnosticProfile apiv1alpha1.DiagnosticsProfile + providerConfig *runtime.RawExtension + workerConfig apiv1alpha1.WorkerConfig + shootVersionMajorMinor string shootVersion string @@ -226,6 +231,25 @@ var _ = Describe("Machines", func() { Zone: "no-zone", } + diagnosticProfile = apiv1alpha1.DiagnosticsProfile{ + Enabled: true, + StorageURI: pointer.String("azure-storage-uri"), + } + + workerConfig = apiv1alpha1.WorkerConfig{ + TypeMeta: metav1.TypeMeta{ + APIVersion: apiv1alpha1.SchemeGroupVersion.String(), + Kind: "WorkerConfig", + }, + DiagnosticsProfile: &diagnosticProfile, + } + + marshalledWorkerConfig, err := json.Marshal(workerConfig) + Expect(err).To(BeNil()) + providerConfig = &runtime.RawExtension{ + Raw: marshalledWorkerConfig, + } + namePool2 = "pool-zones" minPool2 = 30 maxPool2 = 45 @@ -310,7 +334,8 @@ var _ = Describe("Machines", func() { Type: &dataVolume2Type, }, }, - Labels: labels, + Labels: labels, + ProviderConfig: providerConfig, } pool2 = extensionsv1alpha1.WorkerPool{ @@ -502,6 +527,11 @@ var _ = Describe("Machines", func() { machineClassPool3["nodeTemplate"] = nodeTemplateZone3 machineClassPool4["nodeTemplate"] = nodeTemplateZone4 + machineClassPool1["diagnosticsProfile"] = map[string]interface{}{ + "enabled": diagnosticProfile.Enabled, + "storageURI": diagnosticProfile.StorageURI, + } + machineClassPool1["dataDisks"] = []map[string]interface{}{ { "name": dataVolume2Name,