@ -26,10 +26,6 @@ func TestMapFromVMWithEmptyTags(t *testing.T) {
vmType := "type"
location := "westeurope"
networkProfile := compute . NetworkProfile { }
provisioningStatusCode := "ProvisioningState/succeeded"
provisionDisplayStatus := "Provisioning succeeded"
powerStatusCode := "PowerState/running"
powerDisplayStatus := "VM running"
properties := & compute . VirtualMachineProperties {
StorageProfile : & compute . StorageProfile {
OsDisk : & compute . OSDisk {
@ -37,20 +33,6 @@ func TestMapFromVMWithEmptyTags(t *testing.T) {
} ,
} ,
NetworkProfile : & networkProfile ,
InstanceView : & compute . VirtualMachineInstanceView {
Statuses : & [ ] compute . InstanceViewStatus {
{
Code : & provisioningStatusCode ,
Level : "Info" ,
DisplayStatus : & provisionDisplayStatus ,
} ,
{
Code : & powerStatusCode ,
Level : "Info" ,
DisplayStatus : & powerDisplayStatus ,
} ,
} ,
} ,
}
testVM := compute . VirtualMachine {
@ -70,7 +52,6 @@ func TestMapFromVMWithEmptyTags(t *testing.T) {
OsType : "Linux" ,
Tags : map [ string ] * string { } ,
NetworkProfile : networkProfile ,
PowerStateCode : "PowerState/running" ,
}
actualVM := mapFromVM ( testVM )
@ -88,10 +69,6 @@ func TestMapFromVMWithTags(t *testing.T) {
tags := map [ string ] * string {
"prometheus" : new ( string ) ,
}
provisioningStatusCode := "ProvisioningState/succeeded"
provisionDisplayStatus := "Provisioning succeeded"
powerStatusCode := "PowerState/running"
powerDisplayStatus := "VM running"
networkProfile := compute . NetworkProfile { }
properties := & compute . VirtualMachineProperties {
StorageProfile : & compute . StorageProfile {
@ -100,20 +77,6 @@ func TestMapFromVMWithTags(t *testing.T) {
} ,
} ,
NetworkProfile : & networkProfile ,
InstanceView : & compute . VirtualMachineInstanceView {
Statuses : & [ ] compute . InstanceViewStatus {
{
Code : & provisioningStatusCode ,
Level : "Info" ,
DisplayStatus : & provisionDisplayStatus ,
} ,
{
Code : & powerStatusCode ,
Level : "Info" ,
DisplayStatus : & powerDisplayStatus ,
} ,
} ,
} ,
}
testVM := compute . VirtualMachine {
@ -133,7 +96,6 @@ func TestMapFromVMWithTags(t *testing.T) {
OsType : "Linux" ,
Tags : tags ,
NetworkProfile : networkProfile ,
PowerStateCode : "PowerState/running" ,
}
actualVM := mapFromVM ( testVM )
@ -149,10 +111,6 @@ func TestMapFromVMScaleSetVMWithEmptyTags(t *testing.T) {
vmType := "type"
location := "westeurope"
networkProfile := compute . NetworkProfile { }
provisioningStatusCode := "ProvisioningState/succeeded"
provisionDisplayStatus := "Provisioning succeeded"
powerStatusCode := "PowerState/running"
powerDisplayStatus := "VM running"
properties := & compute . VirtualMachineScaleSetVMProperties {
StorageProfile : & compute . StorageProfile {
OsDisk : & compute . OSDisk {
@ -160,20 +118,6 @@ func TestMapFromVMScaleSetVMWithEmptyTags(t *testing.T) {
} ,
} ,
NetworkProfile : & networkProfile ,
InstanceView : & compute . VirtualMachineInstanceView {
Statuses : & [ ] compute . InstanceViewStatus {
{
Code : & provisioningStatusCode ,
Level : "Info" ,
DisplayStatus : & provisionDisplayStatus ,
} ,
{
Code : & powerStatusCode ,
Level : "Info" ,
DisplayStatus : & powerDisplayStatus ,
} ,
} ,
} ,
}
testVM := compute . VirtualMachineScaleSetVM {
@ -195,7 +139,6 @@ func TestMapFromVMScaleSetVMWithEmptyTags(t *testing.T) {
Tags : map [ string ] * string { } ,
NetworkProfile : networkProfile ,
ScaleSet : scaleSet ,
PowerStateCode : "PowerState/running" ,
}
actualVM := mapFromVMScaleSetVM ( testVM , scaleSet )
@ -214,10 +157,6 @@ func TestMapFromVMScaleSetVMWithTags(t *testing.T) {
"prometheus" : new ( string ) ,
}
networkProfile := compute . NetworkProfile { }
provisioningStatusCode := "ProvisioningState/succeeded"
provisionDisplayStatus := "Provisioning succeeded"
powerStatusCode := "PowerState/running"
powerDisplayStatus := "VM running"
properties := & compute . VirtualMachineScaleSetVMProperties {
StorageProfile : & compute . StorageProfile {
OsDisk : & compute . OSDisk {
@ -225,20 +164,6 @@ func TestMapFromVMScaleSetVMWithTags(t *testing.T) {
} ,
} ,
NetworkProfile : & networkProfile ,
InstanceView : & compute . VirtualMachineInstanceView {
Statuses : & [ ] compute . InstanceViewStatus {
{
Code : & provisioningStatusCode ,
Level : "Info" ,
DisplayStatus : & provisionDisplayStatus ,
} ,
{
Code : & powerStatusCode ,
Level : "Info" ,
DisplayStatus : & powerDisplayStatus ,
} ,
} ,
} ,
}
testVM := compute . VirtualMachineScaleSetVM {
@ -260,7 +185,6 @@ func TestMapFromVMScaleSetVMWithTags(t *testing.T) {
Tags : tags ,
NetworkProfile : networkProfile ,
ScaleSet : scaleSet ,
PowerStateCode : "PowerState/running" ,
}
actualVM := mapFromVMScaleSetVM ( testVM , scaleSet )
@ -269,52 +193,3 @@ func TestMapFromVMScaleSetVMWithTags(t *testing.T) {
t . Errorf ( "Expected %v got %v" , expectedVM , actualVM )
}
}
func TestGetPowerStatusFromVM ( t * testing . T ) {
provisioningStatusCode := "ProvisioningState/succeeded"
provisionDisplayStatus := "Provisioning succeeded"
powerStatusCode := "PowerState/running"
powerDisplayStatus := "VM running"
properties := & compute . VirtualMachineScaleSetVMProperties {
StorageProfile : & compute . StorageProfile {
OsDisk : & compute . OSDisk {
OsType : "Linux" ,
} ,
} ,
InstanceView : & compute . VirtualMachineInstanceView {
Statuses : & [ ] compute . InstanceViewStatus {
{
Code : & provisioningStatusCode ,
Level : "Info" ,
DisplayStatus : & provisionDisplayStatus ,
} ,
{
Code : & powerStatusCode ,
Level : "Info" ,
DisplayStatus : & powerDisplayStatus ,
} ,
} ,
} ,
}
testVM := compute . VirtualMachineScaleSetVM {
Properties : properties ,
}
actual := getPowerStateFromVMInstanceView ( testVM . Properties . InstanceView )
expected := "PowerState/running"
if actual != expected {
t . Errorf ( "expected powerStatus %s, but got %s instead" , expected , actual )
}
// Noq we test a virtualMachine with an empty InstanceView struct.
testVM . Properties . InstanceView = & compute . VirtualMachineInstanceView { }
actual = getPowerStateFromVMInstanceView ( testVM . Properties . InstanceView )
if actual != "" {
t . Errorf ( "expected powerStatus %s, but got %s instead" , expected , actual )
}
}