@@ -88,13 +88,57 @@ func TestValidateBasic(t *testing.T) {
8888 assert .Nil (t , runtimeInsideValidate (g ))
8989}
9090
91+ // Test whether rootfs Readonly can be applied as false
92+ func TestValidateRootFSReadWrite (t * testing.T ) {
93+ g := getDefaultGenerator ()
94+ g .SetRootReadonly (false )
95+
96+ assert .Nil (t , runtimeInsideValidate (g ))
97+ }
98+
99+ // Test whether rootfs Readonly can be applied as true
100+ func TestValidateRootFSReadonly (t * testing.T ) {
101+ if "windows" == runtime .GOOS {
102+ t .Skip ("skip this test on windows platform" )
103+ }
104+
105+ g := getDefaultGenerator ()
106+ g .SetRootReadonly (true )
107+
108+ assert .Nil (t , runtimeInsideValidate (g ))
109+ }
110+
111+ // Test whether hostname can be applied or not
112+ func TestValidateHostname (t * testing.T ) {
113+ g := getDefaultGenerator ()
114+ g .SetHostname ("hostname-specific" )
115+
116+ assert .Nil (t , runtimeInsideValidate (g ))
117+ }
118+
119+ // Test whether mounts are correctly mounted
120+ func TestValidateMounts (t * testing.T ) {
121+ // TODO mounts generation options have not been implemented
122+ // will add it after 'mounts generate' done
123+ }
124+
125+ // Test whether rlimits can be applied or not
126+ func TestValidateRlimits (t * testing.T ) {
127+ g := getDefaultGenerator ()
128+ g .AddProcessRlimits ("RLIMIT_NOFILE" , 1024 , 1024 )
129+
130+ assert .Nil (t , runtimeInsideValidate (g ))
131+ }
132+
133+ // Test whether sysctls can be applied or not
91134func TestValidateSysctls (t * testing.T ) {
92135 g := getDefaultGenerator ()
93136 g .AddLinuxSysctl ("net.ipv4.ip_forward" , "1" )
94137
95138 assert .Nil (t , runtimeInsideValidate (g ))
96139}
97140
141+ // Test Create operation
98142func TestValidateCreate (t * testing.T ) {
99143 g := generate .New ()
100144 g .SetRootPath ("." )
0 commit comments