File tree 3 files changed +46
-3
lines changed 3 files changed +46
-3
lines changed Original file line number Diff line number Diff line change 125
125
# 🟢 Builtin default: 0 (automatically assigned to a free port)
126
126
# NOTE: when the instance name is "default", the builtin default value is set to
127
127
# 60022 for backward compatibility.
128
- localPort : 0
128
+ localPort : null
129
129
# Load ~/.ssh/*.pub in addition to $LIMA_HOME/_config/user.pub .
130
130
# This option is useful when you want to use other SSH-based
131
131
# applications such as rsync with the Lima instance.
Original file line number Diff line number Diff line change @@ -72,8 +72,8 @@ const (
72
72
)
73
73
74
74
type Rosetta struct {
75
- Enabled * bool `yaml:"enabled" json:"enabled"`
76
- BinFmt * bool `yaml:"binfmt" json:"binfmt"`
75
+ Enabled * bool `yaml:"enabled,omitempty " json:"enabled,omitempty "`
76
+ BinFmt * bool `yaml:"binfmt,omitempty " json:"binfmt,omitempty "`
77
77
}
78
78
79
79
type File struct {
Original file line number Diff line number Diff line change
1
+ package limayaml
2
+
3
+ import (
4
+ "encoding/json"
5
+ "os"
6
+ "testing"
7
+
8
+ "gotest.tools/v3/assert"
9
+ )
10
+
11
+ func dumpJSON (t * testing.T , d interface {}) string {
12
+ b , err := json .Marshal (d )
13
+ if err != nil {
14
+ t .Fatal (err )
15
+ }
16
+ return string (b )
17
+ }
18
+
19
+ const emptyYAML = "images: []\n "
20
+
21
+ func TestEmptyYAML (t * testing.T ) {
22
+ var y LimaYAML
23
+ t .Log (dumpJSON (t , y ))
24
+ b , err := marshalYAML (y )
25
+ assert .NilError (t , err )
26
+ assert .Equal (t , string (b ), emptyYAML )
27
+ }
28
+
29
+ const defaultYAML = "images: []\n "
30
+
31
+ func TestDefaultYAML (t * testing.T ) {
32
+ bytes , err := os .ReadFile ("default.yaml" )
33
+ assert .NilError (t , err )
34
+ var y LimaYAML
35
+ err = unmarshalYAML (bytes , & y , "" )
36
+ assert .NilError (t , err )
37
+ y .Images = nil // remove default images
38
+ y .Mounts = nil // remove default mounts
39
+ t .Log (dumpJSON (t , y ))
40
+ b , err := marshalYAML (y )
41
+ assert .NilError (t , err )
42
+ assert .Equal (t , string (b ), defaultYAML )
43
+ }
You can’t perform that action at this time.
0 commit comments