mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Fix unit tests
This commit is contained in:
parent
86111df41d
commit
97fab90cd5
@ -24,6 +24,7 @@ go_library(
|
||||
"azure_storageaccount.go",
|
||||
"azure_util.go",
|
||||
"azure_util_vmss.go",
|
||||
"azure_vmsets.go",
|
||||
"azure_wrap.go",
|
||||
"azure_zones.go",
|
||||
],
|
||||
|
@ -870,6 +870,7 @@ func getTestCloud() (az *Cloud) {
|
||||
az.SecurityGroupsClient = newFakeAzureNSGClient()
|
||||
az.VirtualMachinesClient = newFakeAzureVirtualMachinesClient()
|
||||
az.InterfacesClient = newFakeAzureInterfacesClient()
|
||||
az.vmSet = newAvailabilitySet(az)
|
||||
|
||||
return az
|
||||
}
|
||||
@ -1631,7 +1632,8 @@ func TestDecodeInstanceInfo(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSplitProviderID(t *testing.T) {
|
||||
func TestGetNodeNameByProviderID(t *testing.T) {
|
||||
az := getTestCloud()
|
||||
providers := []struct {
|
||||
providerID string
|
||||
name types.NodeName
|
||||
@ -1666,7 +1668,7 @@ func TestSplitProviderID(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, test := range providers {
|
||||
name, err := splitProviderID(test.providerID)
|
||||
name, err := az.vmSet.GetNodeNameByProviderID(test.providerID)
|
||||
if (err != nil) != test.fail {
|
||||
t.Errorf("Expected to failt=%t, with pattern %v", test.fail, test)
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGetVmssInstanceID(t *testing.T) {
|
||||
func TestGetScaleSetVMInstanceID(t *testing.T) {
|
||||
tests := []struct {
|
||||
msg string
|
||||
machineName string
|
||||
@ -43,7 +43,7 @@ func TestGetVmssInstanceID(t *testing.T) {
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
instanceID, err := getVmssInstanceID(test.machineName)
|
||||
instanceID, err := getScaleSetVMInstanceID(test.machineName)
|
||||
if test.expectError {
|
||||
assert.Error(t, err, fmt.Sprintf("TestCase[%d]: %s", i, test.msg))
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user