github.com/fabiokung/docker@v0.11.2-0.20170222101415-4534dcd49497/daemon/config/config_common_unix_test.go (about) 1 // +build !windows 2 3 package config 4 5 import ( 6 "testing" 7 8 "github.com/docker/docker/api/types" 9 ) 10 11 func TestCommonUnixValidateConfigurationErrors(t *testing.T) { 12 testCases := []struct { 13 config *Config 14 }{ 15 // Can't override the stock runtime 16 { 17 config: &Config{ 18 CommonUnixConfig: CommonUnixConfig{ 19 Runtimes: map[string]types.Runtime{ 20 StockRuntimeName: {}, 21 }, 22 }, 23 }, 24 }, 25 // Default runtime should be present in runtimes 26 { 27 config: &Config{ 28 CommonUnixConfig: CommonUnixConfig{ 29 Runtimes: map[string]types.Runtime{ 30 "foo": {}, 31 }, 32 DefaultRuntime: "bar", 33 }, 34 }, 35 }, 36 } 37 for _, tc := range testCases { 38 err := Validate(tc.config) 39 if err == nil { 40 t.Fatalf("expected error, got nil for config %v", tc.config) 41 } 42 } 43 }