(t *testing.T)
| 16 | ) |
| 17 | |
| 18 | func TestHookWithoutExecution(t *testing.T) { |
| 19 | // Execute 0 hooks |
| 20 | // conf := config.NewConfig(nil, &latest.Config{}, nil, nil, constants.DefaultConfigPath) |
| 21 | conf := config.NewConfig(map[string]interface{}{}, |
| 22 | map[string]interface{}{}, |
| 23 | latest.NewRaw(), |
| 24 | localcache.New(constants.DefaultCacheFolder), |
| 25 | &remotecache.RemoteCache{}, |
| 26 | map[string]interface{}{}, |
| 27 | constants.DefaultConfigPath) |
| 28 | err := ExecuteHooks(devspacecontext.NewContext(context.Background(), nil, log.Discard).WithConfig(conf), nil) |
| 29 | if err != nil { |
| 30 | t.Fatalf("Failed to execute 0 hooks with error: %v", err) |
| 31 | } |
| 32 | |
| 33 | conf = config.NewConfig(map[string]interface{}{}, |
| 34 | map[string]interface{}{}, |
| 35 | &latest.Config{ |
| 36 | Hooks: []*latest.HookConfig{{}}, |
| 37 | }, |
| 38 | localcache.New(constants.DefaultCacheFolder), |
| 39 | &remotecache.RemoteCache{}, |
| 40 | map[string]interface{}{}, |
| 41 | constants.DefaultConfigPath) |
| 42 | err = ExecuteHooks(devspacecontext.NewContext(context.Background(), nil, log.Discard).WithConfig(conf), nil) |
| 43 | if err != nil { |
| 44 | t.Fatalf("Failed to execute 1 hook without when with error: %v", err) |
| 45 | } |
| 46 | |
| 47 | conf = config.NewConfig(map[string]interface{}{}, |
| 48 | map[string]interface{}{}, |
| 49 | &latest.Config{ |
| 50 | Hooks: []*latest.HookConfig{{ |
| 51 | Events: []string{"before:deploy"}, |
| 52 | }}, |
| 53 | }, |
| 54 | localcache.New(constants.DefaultCacheFolder), |
| 55 | &remotecache.RemoteCache{}, |
| 56 | map[string]interface{}{}, |
| 57 | constants.DefaultConfigPath) |
| 58 | |
| 59 | err = ExecuteHooks(devspacecontext.NewContext(context.Background(), nil, log.Discard).WithConfig(conf), nil) |
| 60 | if err != nil { |
| 61 | t.Fatalf("Failed to execute 1 hook without When.Before and When.After with error: %v", err) |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | func TestHookWithExecution(t *testing.T) { |
| 66 | conf := config.NewConfig(map[string]interface{}{}, |
nothing calls this directly
no test coverage detected