@@ -30,6 +30,7 @@ func TestConfig(t *testing.T) {
30
30
assert .NilError (t , err )
31
31
t .Log (string (config ))
32
32
assert .Assert (t , ! strings .Contains (string (config ), "ca_certs:" ))
33
+ assert .Assert (t , ! strings .Contains (string (config ), "mounts:" ))
33
34
}
34
35
35
36
func TestConfigCACerts (t * testing.T ) {
@@ -54,6 +55,51 @@ func TestConfigCACerts(t *testing.T) {
54
55
assert .Assert (t , strings .Contains (string (config ), "ca_certs:" ))
55
56
}
56
57
58
+ var defaultMounts = []Mount {
59
+ {MountPoint : "/home/foo.linux" , Tag : "mount0" , Type : "virtiofs" , Options : "ro" },
60
+ {MountPoint : "/tmp/lima" , Tag : "mount1" , Type : "virtiofs" },
61
+ }
62
+
63
+ func TestConfigMounts (t * testing.T ) {
64
+ args := & TemplateArgs {
65
+ Name : "default" ,
66
+ User : "foo" ,
67
+ UID : 501 ,
68
+ Comment : "Foo" ,
69
+ Home : "/home/foo.linux" ,
70
+ Shell : "/bin/bash" ,
71
+ SSHPubKeys : []string {
72
+ "ssh-rsa dummy [email protected] " ,
73
+ },
74
+ MountType : "virtiofs" , // override
75
+ Mounts : defaultMounts ,
76
+ }
77
+ config , err := ExecuteTemplateCloudConfig (args )
78
+ assert .NilError (t , err )
79
+ t .Log (string (config ))
80
+ assert .Assert (t , strings .Contains (string (config ), "mounts:" ))
81
+ }
82
+
83
+ func TestConfigMountsNone (t * testing.T ) {
84
+ args := & TemplateArgs {
85
+ Name : "default" ,
86
+ User : "foo" ,
87
+ UID : 501 ,
88
+ Comment : "Foo" ,
89
+ Home : "/home/foo.linux" ,
90
+ Shell : "/bin/bash" ,
91
+ SSHPubKeys : []string {
92
+ "ssh-rsa dummy [email protected] " ,
93
+ },
94
+ MountType : "virtiofs" , // override
95
+ Mounts : []Mount {},
96
+ }
97
+ config , err := ExecuteTemplateCloudConfig (args )
98
+ assert .NilError (t , err )
99
+ t .Log (string (config ))
100
+ assert .Assert (t , ! strings .Contains (string (config ), "mounts:" ))
101
+ }
102
+
57
103
func TestTemplate (t * testing.T ) {
58
104
args := & TemplateArgs {
59
105
Name : "default" ,
0 commit comments