Skip to content

Commit

Permalink
fix after CR 1
Browse files Browse the repository at this point in the history
  • Loading branch information
jkralik committed Jul 12, 2024
1 parent e4f884f commit 408c123
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions snippet-service/service/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type ClientsConfig struct {
Storage storeConfig.Config `yaml:"storage" json:"storage"`
OpenTelemetryCollector otelClient.Config `yaml:"openTelemetryCollector" json:"openTelemetryCollector"`
EventBus EventBusConfig `yaml:"eventBus" json:"eventBus"`
ResourceUpdater updater.ResourceUpdaterConfig `yaml:"resourceAggregate" json:"resourceAggregate"`
ResourceAggregate updater.ResourceUpdaterConfig `yaml:"resourceAggregate" json:"resourceAggregate"`
}

func (c *ClientsConfig) Validate() error {
Expand All @@ -75,8 +75,8 @@ func (c *ClientsConfig) Validate() error {
if err := c.EventBus.Validate(); err != nil {
return fmt.Errorf("eventBus.%w", err)
}
if err := c.ResourceUpdater.Validate(); err != nil {
return fmt.Errorf("resourceUpdater.%w", err)
if err := c.ResourceAggregate.Validate(); err != nil {
return fmt.Errorf("resourceAggregate.%w", err)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion snippet-service/service/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func TestClientsConfig(t *testing.T) {
name: "invalid ResourceUpdater",
cfg: func() service.ClientsConfig {
cfg := test.MakeClientsConfig()
cfg.ResourceUpdater = updater.ResourceUpdaterConfig{}
cfg.ResourceAggregate = updater.ResourceUpdaterConfig{}
return cfg
}(),
wantErr: true,
Expand Down
4 changes: 2 additions & 2 deletions snippet-service/service/http/invokeConfiguration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ func TestRequestHandlerInvokeConfiguration(t *testing.T) {
}()

snippetCfg := test.MakeConfig(t)
snippetCfg.Clients.ResourceUpdater.CleanUpExpiredUpdates = "*/1 * * * * *"
snippetCfg.Clients.ResourceUpdater.ExtendCronParserBySeconds = true
snippetCfg.Clients.ResourceAggregate.CleanUpExpiredUpdates = "*/1 * * * * *"
snippetCfg.Clients.ResourceAggregate.ExtendCronParserBySeconds = true
_, shutdownHttp := test.New(t, snippetCfg)
defer shutdownHttp()
logger := log.NewLogger(snippetCfg.Log)
Expand Down
2 changes: 1 addition & 1 deletion snippet-service/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func New(ctx context.Context, config Config, fileWatcher *fsnotify.Watcher, logg
}
})

resourceUpdater, err := updater.NewResourceUpdater(ctx, config.Clients.ResourceUpdater, db, fileWatcher, logger, tracerProvider)
resourceUpdater, err := updater.NewResourceUpdater(ctx, config.Clients.ResourceAggregate, db, fileWatcher, logger, tracerProvider)
if err != nil {
closerFn.Execute()
return nil, fmt.Errorf("cannot create resource change handler: %w", err)
Expand Down
6 changes: 3 additions & 3 deletions snippet-service/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func TestServiceNew(t *testing.T) {
name: "invalid resource aggregate client config",
cfg: func() service.Config {
cfg := test.MakeConfig(t)
cfg.Clients.ResourceUpdater = updater.ResourceUpdaterConfig{}
cfg.Clients.ResourceAggregate = updater.ResourceUpdaterConfig{}
return cfg
}(),
wantErr: true,
Expand Down Expand Up @@ -186,8 +186,8 @@ func TestService(t *testing.T) {

snippetCfg := test.MakeConfig(t)
const interval = time.Second
snippetCfg.Clients.ResourceUpdater.CleanUpExpiredUpdates = "*/1 * * * * *"
snippetCfg.Clients.ResourceUpdater.ExtendCronParserBySeconds = true
snippetCfg.Clients.ResourceAggregate.CleanUpExpiredUpdates = "*/1 * * * * *"
snippetCfg.Clients.ResourceAggregate.ExtendCronParserBySeconds = true
_, shutdownSnippetService := test.New(t, snippetCfg)
defer shutdownSnippetService()

Expand Down
4 changes: 2 additions & 2 deletions snippet-service/test/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func MakeAPIsConfig() service.APIsConfig {
}
}

func MakeResourceUpdaterConfig() updater.ResourceUpdaterConfig {
func MakeResourceAggregateConfig() updater.ResourceUpdaterConfig {
return updater.ResourceUpdaterConfig{
Connection: config.MakeGrpcClientConfig(config.RESOURCE_AGGREGATE_HOST),
CleanUpExpiredUpdates: "0 * * * *",
Expand All @@ -57,7 +57,7 @@ func MakeClientsConfig() service.ClientsConfig {
NATS: config.MakeSubscriberConfig(),
SubscriptionID: "snippet-service",
},
ResourceUpdater: MakeResourceUpdaterConfig(),
ResourceAggregate: MakeResourceAggregateConfig(),
}
}

Expand Down
6 changes: 3 additions & 3 deletions snippet-service/updater/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ func TestResourceAggregateConfig(t *testing.T) {
}{
{
name: "valid",
cfg: test.MakeResourceUpdaterConfig(),
cfg: test.MakeResourceAggregateConfig(),
},
{
name: "valid - no cron",
cfg: func() updater.ResourceUpdaterConfig {
cfg := test.MakeResourceUpdaterConfig()
cfg := test.MakeResourceAggregateConfig()
cfg.CleanUpExpiredUpdates = ""
return cfg
}(),
Expand All @@ -37,7 +37,7 @@ func TestResourceAggregateConfig(t *testing.T) {
{
name: "invalid - bad cron expression",
cfg: func() updater.ResourceUpdaterConfig {
cfg := test.MakeResourceUpdaterConfig()
cfg := test.MakeResourceAggregateConfig()
cfg.CleanUpExpiredUpdates = "bad"
return cfg
}(),
Expand Down

0 comments on commit 408c123

Please sign in to comment.