config_common_unix_test.go 786 B

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