@@ -89,6 +89,11 @@ func TestFillDefault(t *testing.T) {
8989 // All these slices and maps are empty in "builtin". Add minimal entries here to see that
9090 // their values are retained and defaults for their fields are applied correctly.
9191 y = LimaYAML {
92+ HostResolver : HostResolver {
93+ Hosts : map [string ]string {
94+ "MY.Host" : "host.lima.internal" ,
95+ },
96+ },
9297 Mounts : []Mount {
9398 {Location : "/tmp" },
9499 },
@@ -119,6 +124,10 @@ func TestFillDefault(t *testing.T) {
119124 }
120125
121126 expect := builtin
127+ expect .HostResolver .Hosts = map [string ]string {
128+ "my.host." : "host.lima.internal" ,
129+ }
130+
122131 expect .Mounts = y .Mounts
123132 expect .Mounts [0 ].Writable = pointer .Bool (false )
124133 expect .Mounts [0 ].SSHFS .Cache = pointer .Bool (true )
@@ -195,6 +204,9 @@ func TestFillDefault(t *testing.T) {
195204 HostResolver : HostResolver {
196205 Enabled : pointer .Bool (false ),
197206 IPv6 : pointer .Bool (true ),
207+ Hosts : map [string ]string {
208+ "default" : "localhost" ,
209+ },
198210 },
199211 PropagateProxyEnv : pointer .Bool (false ),
200212
@@ -248,6 +260,9 @@ func TestFillDefault(t *testing.T) {
248260 expect .Containerd .Archives [0 ].Arch = * d .Arch
249261 expect .Mounts [0 ].SSHFS .Cache = pointer .Bool (true )
250262 expect .Mounts [0 ].SSHFS .FollowSymlinks = pointer .Bool (false )
263+ expect .HostResolver .Hosts = map [string ]string {
264+ "default." : d .HostResolver .Hosts ["default" ],
265+ }
251266
252267 y = LimaYAML {}
253268 FillDefault (& y , & d , & LimaYAML {}, filePath )
@@ -270,6 +285,8 @@ func TestFillDefault(t *testing.T) {
270285 expect .Mounts = append (d .Mounts , y .Mounts ... )
271286 expect .Networks = append (d .Networks , y .Networks ... )
272287
288+ expect .HostResolver .Hosts ["default." ] = d .HostResolver .Hosts ["default" ]
289+
273290 // d.DNS will be ignored, and not appended to y.DNS
274291
275292 // "TWO" does not exist in filledDefaults.Env, so is set from d.Env
@@ -312,6 +329,9 @@ func TestFillDefault(t *testing.T) {
312329 HostResolver : HostResolver {
313330 Enabled : pointer .Bool (false ),
314331 IPv6 : pointer .Bool (false ),
332+ Hosts : map [string ]string {
333+ "override." : "underflow" ,
334+ },
315335 },
316336 PropagateProxyEnv : pointer .Bool (false ),
317337
@@ -376,6 +396,9 @@ func TestFillDefault(t *testing.T) {
376396 expect .PortForwards = append (append (o .PortForwards , y .PortForwards ... ), d .PortForwards ... )
377397 expect .Containerd .Archives = append (append (o .Containerd .Archives , y .Containerd .Archives ... ), d .Containerd .Archives ... )
378398
399+ expect .HostResolver .Hosts ["default." ] = d .HostResolver .Hosts ["default" ]
400+ expect .HostResolver .Hosts ["my.host." ] = d .HostResolver .Hosts ["host.lima.internal" ]
401+
379402 // o.Mounts just makes d.Mounts[0] writable because the Location matches
380403 expect .Mounts = append (d .Mounts , y .Mounts ... )
381404 expect .Mounts [0 ].Writable = pointer .Bool (true )
0 commit comments