(t *testing.T)
| 31 | } |
| 32 | |
| 33 | func TestValidateHooks(t *testing.T) { |
| 34 | config := &latest.Config{ |
| 35 | Hooks: []*latest.HookConfig{ |
| 36 | { |
| 37 | Events: []string{ |
| 38 | "after:deploy:my-deployment", |
| 39 | }, |
| 40 | Container: &latest.HookContainer{ |
| 41 | ContainerName: "fakeContainer", |
| 42 | LabelSelector: map[string]string{ |
| 43 | "app": "selectThisContainer", |
| 44 | }, |
| 45 | }, |
| 46 | Command: "doSomething", |
| 47 | }, |
| 48 | }, |
| 49 | } |
| 50 | |
| 51 | err := validateHooks(config) |
| 52 | assert.NilError(t, err) |
| 53 | |
| 54 | config = &latest.Config{ |
| 55 | Hooks: []*latest.HookConfig{ |
| 56 | { |
| 57 | Events: []string{ |
| 58 | "after:deploy:my-deployment", |
| 59 | }, |
| 60 | Container: &latest.HookContainer{ |
| 61 | ContainerName: "fakeContainer", |
| 62 | }, |
| 63 | Command: "doSomething", |
| 64 | }, |
| 65 | }, |
| 66 | } |
| 67 | |
| 68 | err = validateHooks(config) |
| 69 | assert.Error(t, err, "hooks[0].container.containerName is defined but hooks[0].container.labelSelector is not defined") |
| 70 | } |
| 71 | |
| 72 | func TestValidateDev(t *testing.T) { |
| 73 | // test port forwarding |
nothing calls this directly
no test coverage detected