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