Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
y-eight committed Nov 6, 2023
1 parent 59e42ee commit 9475d1e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 12 deletions.
3 changes: 1 addition & 2 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package config

type Config struct {
Checks map[string]any
Updated chan bool
Checks map[string]any
}

func NewConfig() *Config {
Expand Down
File renamed without changes.
8 changes: 1 addition & 7 deletions pkg/config/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package config

import (
"context"
"strings"
)

const (
Expand All @@ -15,10 +14,5 @@ type Loader interface {
}

func NewLoader(cfg *Config, cCfgChecks chan<- map[string]any) Loader {
switch strings.ToUpper("cfg.loaderTyp") {
case gitlabLoader:
return NewHttpLoader(cfg, cCfgChecks)
default:
return NewHttpLoader(cfg, cCfgChecks)
}
return NewHttpLoader(cfg, cCfgChecks)
}
4 changes: 2 additions & 2 deletions pkg/sparrow/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ func (s *Sparrow) Run(ctx context.Context) error {
// Config got updated
// Set checks
s.cfg.Checks = configChecks
s.ReconceilChecks(ctx)
s.ReconcileChecks(ctx)
}
}
}

// Register new Checks, unregister removed Checks & reset Configs of Checks
func (s *Sparrow) ReconceilChecks(ctx context.Context) {
func (s *Sparrow) ReconcileChecks(ctx context.Context) {
for name, check := range s.cfg.Checks {
if existingCheck, ok := s.checks[name]; ok {
// Check already registered, reset config
Expand Down
2 changes: 1 addition & 1 deletion pkg/sparrow/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func TestSparrow_ReconceilChecks(t *testing.T) {
// Send new config to channel
s.cfg.Checks = tt.newChecksConfig

s.ReconceilChecks(context.Background())
s.ReconcileChecks(context.Background())

for newChecksConfigName := range tt.newChecksConfig {
check := checks.RegisteredChecks[newChecksConfigName]()
Expand Down

0 comments on commit 9475d1e

Please sign in to comment.