6
6
"os"
7
7
"path/filepath"
8
8
"runtime"
9
+ "slices"
9
10
"testing"
10
11
11
12
"github.com/google/go-cmp/cmp"
@@ -201,7 +202,7 @@ func TestFillDefault(t *testing.T) {
201
202
"MY.Host" : "host.lima.internal" ,
202
203
}
203
204
204
- expect .Mounts = y .Mounts
205
+ expect .Mounts = slices . Clone ( y .Mounts )
205
206
expect .Mounts [0 ].MountPoint = expect .Mounts [0 ].Location
206
207
expect .Mounts [0 ].Writable = ptr .Of (false )
207
208
expect .Mounts [0 ].SSHFS .Cache = ptr .Of (true )
@@ -218,20 +219,20 @@ func TestFillDefault(t *testing.T) {
218
219
219
220
expect .MountInotify = ptr .Of (false )
220
221
221
- expect .Provision = y .Provision
222
+ expect .Provision = slices . Clone ( y .Provision )
222
223
expect .Provision [0 ].Mode = ProvisionModeSystem
223
224
expect .Provision [0 ].Script = "#!/bin/true # Eins"
224
225
225
- expect .Probes = y .Probes
226
+ expect .Probes = slices . Clone ( y .Probes )
226
227
expect .Probes [0 ].Mode = ProbeModeReadiness
227
228
expect .Probes [0 ].Description = "user probe 1/1"
228
229
expect .Probes [0 ].Script = "#!/bin/true # Eins"
229
230
230
- expect .Networks = y .Networks
231
+ expect .Networks = slices . Clone ( y .Networks )
231
232
expect .Networks [0 ].MACAddress = MACAddress (fmt .Sprintf ("%s#%d" , filePath , 0 ))
232
233
expect .Networks [0 ].Interface = "lima0"
233
234
234
- expect .DNS = y .DNS
235
+ expect .DNS = slices . Clone ( y .DNS )
235
236
expect .PortForwards = []PortForward {
236
237
defaultPortForward ,
237
238
defaultPortForward ,
@@ -273,6 +274,7 @@ func TestFillDefault(t *testing.T) {
273
274
274
275
expect .TimeZone = y .TimeZone
275
276
expect .Firmware = y .Firmware
277
+ expect .Firmware .Images = slices .Clone (y .Firmware .Images )
276
278
277
279
expect .Rosetta = Rosetta {
278
280
Enabled : ptr .Of (false ),
@@ -410,7 +412,9 @@ func TestFillDefault(t *testing.T) {
410
412
411
413
expect = d
412
414
// Also verify that archive arch is filled in
415
+ expect .Containerd .Archives = slices .Clone (d .Containerd .Archives )
413
416
expect .Containerd .Archives [0 ].Arch = * d .Arch
417
+ expect .Mounts = slices .Clone (d .Mounts )
414
418
expect .Mounts [0 ].MountPoint = expect .Mounts [0 ].Location
415
419
expect .Mounts [0 ].SSHFS .Cache = ptr .Of (true )
416
420
expect .Mounts [0 ].SSHFS .FollowSymlinks = ptr .Of (false )
@@ -651,7 +655,7 @@ func TestFillDefault(t *testing.T) {
651
655
expect .Networks [0 ].Lima = o .Networks [1 ].Lima
652
656
653
657
// Only highest prio DNS are retained
654
- expect .DNS = o .DNS
658
+ expect .DNS = slices . Clone ( o .DNS )
655
659
656
660
// ONE remains from filledDefaults.Env; the rest are set from o
657
661
expect .Env ["ONE" ] = y .Env ["ONE" ]
0 commit comments