MCPcopy Index your code
hub / github.com/devspace-sh/devspace / TestValidateHooks

Function TestValidateHooks

pkg/devspace/config/versions/validate_test.go:33–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31}
32
33func 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
72func TestValidateDev(t *testing.T) {
73 // test port forwarding

Callers

nothing calls this directly

Calls 2

validateHooksFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected