@@ -65,7 +65,7 @@ func TestDecodeContainerConfig(t *testing.T) {
6565 }
6666}
6767
68- // TestDecodeContainerConfigIsolation validates the isolation level passed
68+ // TestDecodeContainerConfigIsolation validates isolation passed
6969// to the daemon in the hostConfig structure. Note this is platform specific
7070// as to what level of container isolation is supported.
7171func TestDecodeContainerConfigIsolation (t * testing.T ) {
@@ -77,17 +77,30 @@ func TestDecodeContainerConfigIsolation(t *testing.T) {
7777 }
7878 }
7979
80- // Blank isolation level (== default)
80+ // Blank isolation (== default)
8181 if _ , _ , _ , err := callDecodeContainerConfigIsolation ("" ); err != nil {
8282 t .Fatal ("Blank isolation should have succeeded" )
8383 }
8484
85- // Default isolation level
85+ // Default isolation
8686 if _ , _ , _ , err := callDecodeContainerConfigIsolation ("default" ); err != nil {
8787 t .Fatal ("default isolation should have succeeded" )
8888 }
8989
90- // Hyper-V Containers isolation level (Valid on Windows only)
90+ // Process isolation (Valid on Windows only)
91+ if runtime .GOOS == "windows" {
92+ if _ , _ , _ , err := callDecodeContainerConfigIsolation ("process" ); err != nil {
93+ t .Fatal ("process isolation should have succeeded" )
94+ }
95+ } else {
96+ if _ , _ , _ , err := callDecodeContainerConfigIsolation ("process" ); err != nil {
97+ if ! strings .Contains (err .Error (), `invalid --isolation: "process"` ) {
98+ t .Fatal (err )
99+ }
100+ }
101+ }
102+
103+ // Hyper-V Containers isolation (Valid on Windows only)
91104 if runtime .GOOS == "windows" {
92105 if _ , _ , _ , err := callDecodeContainerConfigIsolation ("hyperv" ); err != nil {
93106 t .Fatal ("hyperv isolation should have succeeded" )
@@ -102,7 +115,7 @@ func TestDecodeContainerConfigIsolation(t *testing.T) {
102115}
103116
104117// callDecodeContainerConfigIsolation is a utility function to call
105- // DecodeContainerConfig for validating isolation levels
118+ // DecodeContainerConfig for validating isolation
106119func callDecodeContainerConfigIsolation (isolation string ) (* container.Config , * container.HostConfig , * networktypes.NetworkingConfig , error ) {
107120 var (
108121 b []byte
@@ -112,7 +125,7 @@ func callDecodeContainerConfigIsolation(isolation string) (*container.Config, *c
112125 Config : & container.Config {},
113126 HostConfig : & container.HostConfig {
114127 NetworkMode : "none" ,
115- Isolation : container .IsolationLevel (isolation )},
128+ Isolation : container .Isolation (isolation )},
116129 }
117130 if b , err = json .Marshal (w ); err != nil {
118131 return nil , nil , nil , fmt .Errorf ("Error on marshal %s" , err .Error ())
0 commit comments