File tree Expand file tree Collapse file tree 3 files changed +46
-3
lines changed Expand file tree Collapse file tree 3 files changed +46
-3
lines changed Original file line number Diff line number Diff line change 125125 # 🟢 Builtin default: 0 (automatically assigned to a free port)
126126 # NOTE: when the instance name is "default", the builtin default value is set to
127127 # 60022 for backward compatibility.
128- localPort : 0
128+ localPort : null
129129 # Load ~/.ssh/*.pub in addition to $LIMA_HOME/_config/user.pub .
130130 # This option is useful when you want to use other SSH-based
131131 # applications such as rsync with the Lima instance.
Original file line number Diff line number Diff line change @@ -72,8 +72,8 @@ const (
7272)
7373
7474type 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 "`
7777}
7878
7979type 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