Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
hebelsan committed Jun 20, 2024
1 parent b48bfce commit cd0bbe8
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion pkg/controller/worker/machines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package worker_test

import (
"context"
"encoding/json"
"fmt"
"path/filepath"
"strings"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -310,7 +334,8 @@ var _ = Describe("Machines", func() {
Type: &dataVolume2Type,
},
},
Labels: labels,
Labels: labels,
ProviderConfig: providerConfig,
}

pool2 = extensionsv1alpha1.WorkerPool{
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit cd0bbe8

Please sign in to comment.