@@ -93,6 +93,11 @@ func TestFillDefault(t *testing.T) {
9393 // All these slices and maps are empty in "builtin". Add minimal entries here to see that
9494 // their values are retained and defaults for their fields are applied correctly.
9595 y = LimaYAML {
96+ HostResolver : HostResolver {
97+ Hosts : map [string ]string {
98+ "MY.Host" : "host.lima.internal" ,
99+ },
100+ },
96101 Mounts : []Mount {
97102 {Location : "/tmp" },
98103 },
@@ -123,6 +128,10 @@ func TestFillDefault(t *testing.T) {
123128 }
124129
125130 expect := builtin
131+ expect .HostResolver .Hosts = map [string ]string {
132+ "my.host." : "host.lima.internal" ,
133+ }
134+
126135 expect .Mounts = y .Mounts
127136 expect .Mounts [0 ].Writable = pointer .Bool (false )
128137 expect .Mounts [0 ].SSHFS .Cache = pointer .Bool (true )
@@ -202,6 +211,9 @@ func TestFillDefault(t *testing.T) {
202211 HostResolver : HostResolver {
203212 Enabled : pointer .Bool (false ),
204213 IPv6 : pointer .Bool (true ),
214+ Hosts : map [string ]string {
215+ "default" : "localhost" ,
216+ },
205217 },
206218 PropagateProxyEnv : pointer .Bool (false ),
207219
@@ -255,6 +267,9 @@ func TestFillDefault(t *testing.T) {
255267 expect .Containerd .Archives [0 ].Arch = * d .Arch
256268 expect .Mounts [0 ].SSHFS .Cache = pointer .Bool (true )
257269 expect .Mounts [0 ].SSHFS .FollowSymlinks = pointer .Bool (false )
270+ expect .HostResolver .Hosts = map [string ]string {
271+ "default." : d .HostResolver .Hosts ["default" ],
272+ }
258273
259274 y = LimaYAML {}
260275 FillDefault (& y , & d , & LimaYAML {}, filePath )
@@ -277,6 +292,8 @@ func TestFillDefault(t *testing.T) {
277292 expect .Mounts = append (d .Mounts , y .Mounts ... )
278293 expect .Networks = append (d .Networks , y .Networks ... )
279294
295+ expect .HostResolver .Hosts ["default." ] = d .HostResolver .Hosts ["default" ]
296+
280297 // d.DNS will be ignored, and not appended to y.DNS
281298
282299 // "TWO" does not exist in filledDefaults.Env, so is set from d.Env
@@ -322,6 +339,9 @@ func TestFillDefault(t *testing.T) {
322339 HostResolver : HostResolver {
323340 Enabled : pointer .Bool (false ),
324341 IPv6 : pointer .Bool (false ),
342+ Hosts : map [string ]string {
343+ "override." : "underflow" ,
344+ },
325345 },
326346 PropagateProxyEnv : pointer .Bool (false ),
327347
@@ -386,6 +406,9 @@ func TestFillDefault(t *testing.T) {
386406 expect .PortForwards = append (append (o .PortForwards , y .PortForwards ... ), d .PortForwards ... )
387407 expect .Containerd .Archives = append (append (o .Containerd .Archives , y .Containerd .Archives ... ), d .Containerd .Archives ... )
388408
409+ expect .HostResolver .Hosts ["default." ] = d .HostResolver .Hosts ["default" ]
410+ expect .HostResolver .Hosts ["my.host." ] = d .HostResolver .Hosts ["host.lima.internal" ]
411+
389412 // o.Mounts just makes d.Mounts[0] writable because the Location matches
390413 expect .Mounts = append (d .Mounts , y .Mounts ... )
391414 expect .Mounts [0 ].Writable = pointer .Bool (true )
0 commit comments