@@ -1547,7 +1547,7 @@ func TestMachineScope_GetVMImage(t *testing.T) {
1547
1547
expectedErr string
1548
1548
}{
1549
1549
{
1550
- name : "returns AzureMachine image is found if present in the AzureMachine spec" ,
1550
+ name : "returns AzureMachine image if present in the AzureMachine spec" ,
1551
1551
machineScope : MachineScope {
1552
1552
AzureMachine : & infrav1.AzureMachine {
1553
1553
ObjectMeta : metav1.ObjectMeta {
@@ -1566,7 +1566,7 @@ func TestMachineScope_GetVMImage(t *testing.T) {
1566
1566
expectedErr : "" ,
1567
1567
},
1568
1568
{
1569
- name : "if no image is specified and os specified is windows with version below 1.22 , returns windows dockershim image" ,
1569
+ name : "if no image is specified and os specified is windows, returns windows containerd image" ,
1570
1570
machineScope : MachineScope {
1571
1571
Machine : & clusterv1.Machine {
1572
1572
ObjectMeta : metav1.ObjectMeta {
@@ -1589,42 +1589,13 @@ func TestMachineScope_GetVMImage(t *testing.T) {
1589
1589
ClusterScoper : clusterMock ,
1590
1590
},
1591
1591
want : func () * infrav1.Image {
1592
- image , _ := svc .GetDefaultWindowsImage (context .TODO (), "" , "1.20.1" , "dockershim " , "" )
1592
+ image , _ := svc .GetDefaultWindowsImage (context .TODO (), "" , "1.20.1" , "containerd " , "" )
1593
1593
return image
1594
1594
}(),
1595
1595
expectedErr : "" ,
1596
1596
},
1597
1597
{
1598
- name : "if no image is specified and os specified is windows with version is 1.22+ with no annotation, returns windows containerd image" ,
1599
- machineScope : MachineScope {
1600
- Machine : & clusterv1.Machine {
1601
- ObjectMeta : metav1.ObjectMeta {
1602
- Name : "machine-name" ,
1603
- },
1604
- Spec : clusterv1.MachineSpec {
1605
- Version : ptr .To ("1.22.1" ),
1606
- },
1607
- },
1608
- AzureMachine : & infrav1.AzureMachine {
1609
- ObjectMeta : metav1.ObjectMeta {
1610
- Name : "machine-name" ,
1611
- },
1612
- Spec : infrav1.AzureMachineSpec {
1613
- OSDisk : infrav1.OSDisk {
1614
- OSType : azure .WindowsOS ,
1615
- },
1616
- },
1617
- },
1618
- ClusterScoper : clusterMock ,
1619
- },
1620
- want : func () * infrav1.Image {
1621
- image , _ := svc .GetDefaultWindowsImage (context .TODO (), "" , "1.22.1" , "containerd" , "" )
1622
- return image
1623
- }(),
1624
- expectedErr : "" ,
1625
- },
1626
- {
1627
- name : "if no image is specified and os specified is windows with version is 1.22+ with annotation dockershim, returns windows dockershim image" ,
1598
+ name : "if no image is specified and os specified is windows with annotation dockershim, returns error" ,
1628
1599
machineScope : MachineScope {
1629
1600
Machine : & clusterv1.Machine {
1630
1601
ObjectMeta : metav1.ObjectMeta {
@@ -1653,71 +1624,10 @@ func TestMachineScope_GetVMImage(t *testing.T) {
1653
1624
image , _ := svc .GetDefaultWindowsImage (context .TODO (), "" , "1.22.1" , "dockershim" , "" )
1654
1625
return image
1655
1626
}(),
1656
- expectedErr : "" ,
1657
- },
1658
- {
1659
- name : "if no image is specified and os specified is windows with version is less and 1.22 with annotation dockershim, returns windows dockershim image" ,
1660
- machineScope : MachineScope {
1661
- Machine : & clusterv1.Machine {
1662
- ObjectMeta : metav1.ObjectMeta {
1663
- Name : "machine-name" ,
1664
- },
1665
- Spec : clusterv1.MachineSpec {
1666
- Version : ptr .To ("1.21.1" ),
1667
- },
1668
- },
1669
- AzureMachine : & infrav1.AzureMachine {
1670
- ObjectMeta : metav1.ObjectMeta {
1671
- Name : "machine-name" ,
1672
- Annotations : map [string ]string {
1673
- "runtime" : "dockershim" ,
1674
- },
1675
- },
1676
- Spec : infrav1.AzureMachineSpec {
1677
- OSDisk : infrav1.OSDisk {
1678
- OSType : azure .WindowsOS ,
1679
- },
1680
- },
1681
- },
1682
- ClusterScoper : clusterMock ,
1683
- },
1684
- want : func () * infrav1.Image {
1685
- image , _ := svc .GetDefaultWindowsImage (context .TODO (), "" , "1.21.1" , "dockershim" , "" )
1686
- return image
1687
- }(),
1688
- expectedErr : "" ,
1627
+ expectedErr : "unsupported runtime dockershim" ,
1689
1628
},
1690
1629
{
1691
- name : "if no image is specified and os specified is windows with version is less and 1.22 with annotation containerd, returns error" ,
1692
- machineScope : MachineScope {
1693
- Machine : & clusterv1.Machine {
1694
- ObjectMeta : metav1.ObjectMeta {
1695
- Name : "machine-name" ,
1696
- },
1697
- Spec : clusterv1.MachineSpec {
1698
- Version : ptr .To ("1.21.1" ),
1699
- },
1700
- },
1701
- AzureMachine : & infrav1.AzureMachine {
1702
- ObjectMeta : metav1.ObjectMeta {
1703
- Name : "machine-name" ,
1704
- Annotations : map [string ]string {
1705
- "runtime" : "containerd" ,
1706
- },
1707
- },
1708
- Spec : infrav1.AzureMachineSpec {
1709
- OSDisk : infrav1.OSDisk {
1710
- OSType : azure .WindowsOS ,
1711
- },
1712
- },
1713
- },
1714
- ClusterScoper : clusterMock ,
1715
- },
1716
- want : nil ,
1717
- expectedErr : "containerd image only supported in 1.22+" ,
1718
- },
1719
- {
1720
- name : "if no image is specified and os specified is windows with windowsServerVersion annotation set to 2019, retrurns 2019 image" ,
1630
+ name : "if no image is specified and os specified is windows with windowsServerVersion annotation set to 2019, returns error" ,
1721
1631
machineScope : MachineScope {
1722
1632
Machine : & clusterv1.Machine {
1723
1633
ObjectMeta : metav1.ObjectMeta {
@@ -1746,7 +1656,7 @@ func TestMachineScope_GetVMImage(t *testing.T) {
1746
1656
image , _ := svc .GetDefaultWindowsImage (context .TODO (), "" , "1.23.3" , "" , "windows-2019" )
1747
1657
return image
1748
1658
}(),
1749
- expectedErr : "" ,
1659
+ expectedErr : "unsupported osAndVersion windows-2019 " ,
1750
1660
},
1751
1661
{
1752
1662
name : "if no image is specified and os specified is windows with windowsServerVersion annotation set to 2022, retrurns 2022 image" ,
@@ -1799,7 +1709,7 @@ func TestMachineScope_GetVMImage(t *testing.T) {
1799
1709
ClusterScoper : clusterMock ,
1800
1710
},
1801
1711
want : func () * infrav1.Image {
1802
- image , _ := svc .GetDefaultUbuntuImage (context .TODO (), "" , "1.20.1" )
1712
+ image , _ := svc .GetDefaultLinuxImage (context .TODO (), "" , "1.20.1" )
1803
1713
return image
1804
1714
}(),
1805
1715
expectedErr : "" ,
0 commit comments