@@ -451,6 +451,8 @@ func TestFillDefault(t *testing.T) {
451
451
FillDefault (& y , & d , & LimaYAML {}, filePath )
452
452
assert .DeepEqual (t , & y , & expect , opts ... )
453
453
454
+ dExpect := expect
455
+
454
456
// ------------------------------------------------------------------------------------
455
457
// User-provided defaults should not override user-provided config values
456
458
@@ -460,26 +462,27 @@ func TestFillDefault(t *testing.T) {
460
462
461
463
expect = y
462
464
463
- expect .Provision = append (append ([]Provision {}, y .Provision ... ), d .Provision ... )
464
- expect .Probes = append (append ([]Probe {}, y .Probes ... ), d .Probes ... )
465
- expect .PortForwards = append (append ([]PortForward {}, y .PortForwards ... ), d .PortForwards ... )
466
- expect .CopyToHost = append (append ([]CopyToHost {}, y .CopyToHost ... ), d .CopyToHost ... )
467
- expect .Containerd .Archives = append (append ([]File {}, y .Containerd .Archives ... ), d .Containerd .Archives ... )
468
- expect .AdditionalDisks = append (append ([]Disk {}, y .AdditionalDisks ... ), d .AdditionalDisks ... )
469
- expect .Firmware .Images = append (append ([]FileWithVMType {}, y .Firmware .Images ... ), d .Firmware .Images ... )
465
+ expect .Provision = append (append ([]Provision {}, y .Provision ... ), dExpect .Provision ... )
466
+ expect .Probes = append (append ([]Probe {}, y .Probes ... ), dExpect .Probes ... )
467
+ expect .PortForwards = append (append ([]PortForward {}, y .PortForwards ... ), dExpect .PortForwards ... )
468
+ expect .CopyToHost = append (append ([]CopyToHost {}, y .CopyToHost ... ), dExpect .CopyToHost ... )
469
+ expect .Containerd .Archives = append (append ([]File {}, y .Containerd .Archives ... ), dExpect .Containerd .Archives ... )
470
+ expect .Containerd .Archives [2 ].Arch = * expect .Arch
471
+ expect .AdditionalDisks = append (append ([]Disk {}, y .AdditionalDisks ... ), dExpect .AdditionalDisks ... )
472
+ expect .Firmware .Images = append (append ([]FileWithVMType {}, y .Firmware .Images ... ), dExpect .Firmware .Images ... )
470
473
471
474
// Mounts and Networks start with lowest priority first, so higher priority entries can overwrite
472
- expect .Mounts = append (append ([]Mount {}, d .Mounts ... ), y .Mounts ... )
473
- expect .Networks = append (append ([]Network {}, d .Networks ... ), y .Networks ... )
475
+ expect .Mounts = append (append ([]Mount {}, dExpect .Mounts ... ), y .Mounts ... )
476
+ expect .Networks = append (append ([]Network {}, dExpect .Networks ... ), y .Networks ... )
474
477
475
- expect .HostResolver .Hosts ["default" ] = d .HostResolver .Hosts ["default" ]
478
+ expect .HostResolver .Hosts ["default" ] = dExpect .HostResolver .Hosts ["default" ]
476
479
477
- // d .DNS will be ignored, and not appended to y.DNS
480
+ // dExpect .DNS will be ignored, and not appended to y.DNS
478
481
479
- // "TWO" does not exist in filledDefaults.Env, so is set from d .Env
480
- expect .Env ["TWO" ] = d .Env ["TWO" ]
482
+ // "TWO" does not exist in filledDefaults.Env, so is set from dExpect .Env
483
+ expect .Env ["TWO" ] = dExpect .Env ["TWO" ]
481
484
482
- expect .Param ["TWO" ] = d .Param ["TWO" ]
485
+ expect .Param ["TWO" ] = dExpect .Param ["TWO" ]
483
486
484
487
t .Logf ("d.vmType=%q, y.vmType=%q, expect.vmType=%q" , * d .VMType , * y .VMType , * expect .VMType )
485
488
@@ -625,19 +628,20 @@ func TestFillDefault(t *testing.T) {
625
628
626
629
expect = o
627
630
628
- expect .Provision = append (append (o .Provision , y .Provision ... ), d .Provision ... )
629
- expect .Probes = append (append (o .Probes , y .Probes ... ), d .Probes ... )
630
- expect .PortForwards = append (append (o .PortForwards , y .PortForwards ... ), d .PortForwards ... )
631
- expect .CopyToHost = append (append (o .CopyToHost , y .CopyToHost ... ), d .CopyToHost ... )
632
- expect .Containerd .Archives = append (append (o .Containerd .Archives , y .Containerd .Archives ... ), d .Containerd .Archives ... )
633
- expect .AdditionalDisks = append (append (o .AdditionalDisks , y .AdditionalDisks ... ), d .AdditionalDisks ... )
634
- expect .Firmware .Images = append (append (o .Firmware .Images , y .Firmware .Images ... ), d .Firmware .Images ... )
631
+ expect .Provision = append (append (o .Provision , y .Provision ... ), dExpect .Provision ... )
632
+ expect .Probes = append (append (o .Probes , y .Probes ... ), dExpect .Probes ... )
633
+ expect .PortForwards = append (append (o .PortForwards , y .PortForwards ... ), dExpect .PortForwards ... )
634
+ expect .CopyToHost = append (append (o .CopyToHost , y .CopyToHost ... ), dExpect .CopyToHost ... )
635
+ expect .Containerd .Archives = append (append (o .Containerd .Archives , y .Containerd .Archives ... ), dExpect .Containerd .Archives ... )
636
+ expect .Containerd .Archives [3 ].Arch = * expect .Arch
637
+ expect .AdditionalDisks = append (append (o .AdditionalDisks , y .AdditionalDisks ... ), dExpect .AdditionalDisks ... )
638
+ expect .Firmware .Images = append (append (o .Firmware .Images , y .Firmware .Images ... ), dExpect .Firmware .Images ... )
635
639
636
- expect .HostResolver .Hosts ["default" ] = d .HostResolver .Hosts ["default" ]
637
- expect .HostResolver .Hosts ["MY.Host" ] = d .HostResolver .Hosts ["host.lima.internal" ]
640
+ expect .HostResolver .Hosts ["default" ] = dExpect .HostResolver .Hosts ["default" ]
641
+ expect .HostResolver .Hosts ["MY.Host" ] = dExpect .HostResolver .Hosts ["host.lima.internal" ]
638
642
639
- // o.Mounts just makes d .Mounts[0] writable because the Location matches
640
- expect .Mounts = append (append ([]Mount {}, d .Mounts ... ), y .Mounts ... )
643
+ // o.Mounts just makes dExpect .Mounts[0] writable because the Location matches
644
+ expect .Mounts = append (append ([]Mount {}, dExpect .Mounts ... ), y .Mounts ... )
641
645
expect .Mounts [0 ].Writable = ptr .Of (true )
642
646
expect .Mounts [0 ].SSHFS .Cache = ptr .Of (false )
643
647
expect .Mounts [0 ].SSHFS .FollowSymlinks = ptr .Of (true )
@@ -650,8 +654,8 @@ func TestFillDefault(t *testing.T) {
650
654
expect .MountType = ptr .Of (NINEP )
651
655
expect .MountInotify = ptr .Of (true )
652
656
653
- // o.Networks[1] is overriding the d .Networks[0].Lima entry for the "def0" interface
654
- expect .Networks = append (append (d .Networks , y .Networks ... ), o .Networks [0 ])
657
+ // o.Networks[1] is overriding the dExpect .Networks[0].Lima entry for the "def0" interface
658
+ expect .Networks = append (append (dExpect .Networks , y .Networks ... ), o .Networks [0 ])
655
659
expect .Networks [0 ].Lima = o .Networks [1 ].Lima
656
660
657
661
// Only highest prio DNS are retained
0 commit comments