-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make cloud instance that is connected to configurable (#148)
* Make cloud instance that is connected to configurable * address review comments - add consts for known good Azure cloud names - add validation of CloudConfig * add unit tests * follow latest changes on provider-ext * address review comments * minor refactoring and corrections * correction in validation test * optimized method parameters for creating connect config --------- Co-authored-by: Rishabh Patel <[email protected]>
- Loading branch information
1 parent
ea7c1d9
commit fe4c7e8
Showing
8 changed files
with
144 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package helpers | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" | ||
"github.com/gardener/machine-controller-manager-provider-azure/pkg/azure/api" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestDetermineAzureCloudConfiguration(t *testing.T) { | ||
type testData struct { | ||
description string | ||
testConfiguration *api.CloudConfiguration | ||
expectedOutput *cloud.Configuration | ||
} | ||
|
||
tests := []testData{ | ||
{description: "cloud configuration name set to AzurePublic", testConfiguration: &api.CloudConfiguration{Name: api.CloudNamePublic}, expectedOutput: &cloud.AzurePublic}, | ||
{description: "cloud configuration name set to AzureChina", testConfiguration: &api.CloudConfiguration{Name: api.CloudNameChina}, expectedOutput: &cloud.AzureChina}, | ||
{description: "cloud configuration name set to AzureGov", testConfiguration: &api.CloudConfiguration{Name: api.CloudNameGov}, expectedOutput: &cloud.AzureGovernment}, | ||
{description: "cloud configuration not set", testConfiguration: nil, expectedOutput: &cloud.AzurePublic}, | ||
} | ||
g := NewWithT(t) | ||
t.Parallel() | ||
for _, test := range tests { | ||
t.Run(test.description, func(t *testing.T) { | ||
cloudConfiguration := DetermineAzureCloudConfiguration(test.testConfiguration) | ||
g.Expect(cloudConfiguration).To(Equal(*test.expectedOutput)) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters