|
|
|
|
@ -79,6 +79,55 @@ func TestMapFromVMWithEmptyTags(t *testing.T) { |
|
|
|
|
require.Equal(t, expectedVM, actualVM) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestMapFromVMWithEmptyOSType(t *testing.T) { |
|
|
|
|
id := "test" |
|
|
|
|
name := "name" |
|
|
|
|
size := "size" |
|
|
|
|
vmSize := armcompute.VirtualMachineSizeTypes(size) |
|
|
|
|
vmType := "type" |
|
|
|
|
location := "westeurope" |
|
|
|
|
computerName := "computer_name" |
|
|
|
|
networkProfile := armcompute.NetworkProfile{ |
|
|
|
|
NetworkInterfaces: []*armcompute.NetworkInterfaceReference{}, |
|
|
|
|
} |
|
|
|
|
properties := &armcompute.VirtualMachineProperties{ |
|
|
|
|
OSProfile: &armcompute.OSProfile{ |
|
|
|
|
ComputerName: &computerName, |
|
|
|
|
}, |
|
|
|
|
StorageProfile: &armcompute.StorageProfile{ |
|
|
|
|
OSDisk: &armcompute.OSDisk{}, |
|
|
|
|
}, |
|
|
|
|
NetworkProfile: &networkProfile, |
|
|
|
|
HardwareProfile: &armcompute.HardwareProfile{ |
|
|
|
|
VMSize: &vmSize, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
testVM := armcompute.VirtualMachine{ |
|
|
|
|
ID: &id, |
|
|
|
|
Name: &name, |
|
|
|
|
Type: &vmType, |
|
|
|
|
Location: &location, |
|
|
|
|
Tags: nil, |
|
|
|
|
Properties: properties, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
expectedVM := virtualMachine{ |
|
|
|
|
ID: id, |
|
|
|
|
Name: name, |
|
|
|
|
ComputerName: computerName, |
|
|
|
|
Type: vmType, |
|
|
|
|
Location: location, |
|
|
|
|
Tags: map[string]*string{}, |
|
|
|
|
NetworkInterfaces: []string{}, |
|
|
|
|
Size: size, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
actualVM := mapFromVM(testVM) |
|
|
|
|
|
|
|
|
|
require.Equal(t, expectedVM, actualVM) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestMapFromVMWithTags(t *testing.T) { |
|
|
|
|
id := "test" |
|
|
|
|
name := "name" |
|
|
|
|
@ -193,6 +242,58 @@ func TestMapFromVMScaleSetVMWithEmptyTags(t *testing.T) { |
|
|
|
|
require.Equal(t, expectedVM, actualVM) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestMapFromVMScaleSetVMWithEmptyOSType(t *testing.T) { |
|
|
|
|
id := "test" |
|
|
|
|
name := "name" |
|
|
|
|
size := "size" |
|
|
|
|
vmSize := armcompute.VirtualMachineSizeTypes(size) |
|
|
|
|
vmType := "type" |
|
|
|
|
instanceID := "123" |
|
|
|
|
location := "westeurope" |
|
|
|
|
computerName := "computer_name" |
|
|
|
|
networkProfile := armcompute.NetworkProfile{ |
|
|
|
|
NetworkInterfaces: []*armcompute.NetworkInterfaceReference{}, |
|
|
|
|
} |
|
|
|
|
properties := &armcompute.VirtualMachineScaleSetVMProperties{ |
|
|
|
|
OSProfile: &armcompute.OSProfile{ |
|
|
|
|
ComputerName: &computerName, |
|
|
|
|
}, |
|
|
|
|
StorageProfile: &armcompute.StorageProfile{}, |
|
|
|
|
NetworkProfile: &networkProfile, |
|
|
|
|
HardwareProfile: &armcompute.HardwareProfile{ |
|
|
|
|
VMSize: &vmSize, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
testVM := armcompute.VirtualMachineScaleSetVM{ |
|
|
|
|
ID: &id, |
|
|
|
|
Name: &name, |
|
|
|
|
Type: &vmType, |
|
|
|
|
InstanceID: &instanceID, |
|
|
|
|
Location: &location, |
|
|
|
|
Tags: nil, |
|
|
|
|
Properties: properties, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
scaleSet := "testSet" |
|
|
|
|
expectedVM := virtualMachine{ |
|
|
|
|
ID: id, |
|
|
|
|
Name: name, |
|
|
|
|
ComputerName: computerName, |
|
|
|
|
Type: vmType, |
|
|
|
|
Location: location, |
|
|
|
|
Tags: map[string]*string{}, |
|
|
|
|
NetworkInterfaces: []string{}, |
|
|
|
|
ScaleSet: scaleSet, |
|
|
|
|
InstanceID: instanceID, |
|
|
|
|
Size: size, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
actualVM := mapFromVMScaleSetVM(testVM, scaleSet) |
|
|
|
|
|
|
|
|
|
require.Equal(t, expectedVM, actualVM) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestMapFromVMScaleSetVMWithTags(t *testing.T) { |
|
|
|
|
id := "test" |
|
|
|
|
name := "name" |
|
|
|
|
|