| 925 | } |
| 926 | |
| 927 | func TestParseLoggingOpts(t *testing.T) { |
| 928 | // logging opts ko |
| 929 | if _, _, _, err := parseRun([]string{"--log-driver=none", "--log-opt=anything", "img", "cmd"}); err == nil || err.Error() != "invalid logging opts for driver none" { |
| 930 | t.Fatalf("Expected an error with message 'invalid logging opts for driver none', got %v", err) |
| 931 | } |
| 932 | // logging opts ok |
| 933 | _, hostconfig, _, err := parseRun([]string{"--log-driver=syslog", "--log-opt=something", "img", "cmd"}) |
| 934 | if err != nil { |
| 935 | t.Fatal(err) |
| 936 | } |
| 937 | if hostconfig.LogConfig.Type != "syslog" || len(hostconfig.LogConfig.Config) != 1 { |
| 938 | t.Fatalf("Expected a 'syslog' LogConfig with one config, got %v", hostconfig.RestartPolicy) |
| 939 | } |
| 940 | } |
| 941 | |
| 942 | func TestParseEnvfileVariables(t *testing.T) { |
| 943 | expErr := "--env-file: open nonexistent: no such file or directory" |