Skip to content

Commit

Permalink
refactor: rename struct field
Browse files Browse the repository at this point in the history
  • Loading branch information
polsar88 committed Oct 7, 2024
1 parent 1f77dd9 commit d861a8c
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 55 deletions.
2 changes: 1 addition & 1 deletion internal/checks/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func NewErrorChecker(
metricsContainer: metricsContainer,
logger: logger,
errorCircuitBreaker: NewErrorStats(routingConfig),
isCheckEnabled: routingConfig.IsCheckEnabled,
isCheckEnabled: routingConfig.IsEnabled,
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/checks/latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func NewLatencyChecker(
metricsContainer: metricsContainer,
logger: logger,
methodLatencyBreaker: make(map[string]LatencyCircuitBreaker),
isCheckEnabled: routingConfig.IsCheckEnabled,
isCheckEnabled: routingConfig.IsEnabled,
}
}

Expand Down
4 changes: 2 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ type RoutingConfig struct {
BanWindow *time.Duration `yaml:"banWindow"`
MaxBlocksBehind int `yaml:"maxBlocksBehind"`
IsInitialized bool
IsCheckEnabled bool
IsEnabled bool
}

// IsEnhancedRoutingControlDefined returns true iff any of the enhanced routing control fields are specified
Expand Down Expand Up @@ -435,7 +435,7 @@ func (r *RoutingConfig) setDefaults(globalConfig *RoutingConfig, force bool) boo
}

r.IsInitialized = true
r.IsCheckEnabled = true
r.IsEnabled = true

return true
}
Expand Down
102 changes: 51 additions & 51 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,10 @@ func TestParseConfig_ValidConfigLatencyRouting_AllFieldsSet(t *testing.T) {
"internal server error",
},
},
Latency: &expectedLatencyConfig,
AlwaysRoute: newBool(true),
IsInitialized: true,
IsCheckEnabled: true,
Latency: &expectedLatencyConfig,
AlwaysRoute: newBool(true),
IsInitialized: true,
IsEnabled: true,
}

expectedRoutingChainConfig := expectedRoutingConfig
Expand Down Expand Up @@ -519,10 +519,10 @@ func TestParseConfig_ValidConfigLatencyRouting_ErrorsConfigOverridesAndMerges(t
"freaking out",
},
},
Latency: &LatencyConfig{MethodLatencyThresholds: map[string]time.Duration{}},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsCheckEnabled: true,
Latency: &LatencyConfig{MethodLatencyThresholds: map[string]time.Duration{}},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsEnabled: true,
}

expectedRoutingChainConfig := expectedRoutingConfig
Expand Down Expand Up @@ -600,10 +600,10 @@ func TestParseConfig_ValidConfigLatencyRouting_DefaultsForDetectionAndBanWindows
Errors: &ErrorsConfig{
Rate: 0.25,
},
Latency: &expectedLatencyConfig,
AlwaysRoute: newBool(false),
IsInitialized: true,
IsCheckEnabled: true,
Latency: &expectedLatencyConfig,
AlwaysRoute: newBool(false),
IsInitialized: true,
IsEnabled: true,
},
},
Chains: getCommonChainsConfig(&RoutingConfig{
Expand All @@ -613,7 +613,7 @@ func TestParseConfig_ValidConfigLatencyRouting_DefaultsForDetectionAndBanWindows
Latency: &expectedLatencyConfig,
AlwaysRoute: newBool(false),
IsInitialized: true,
IsCheckEnabled: true,
IsEnabled: true,
}),
}

Expand Down Expand Up @@ -762,10 +762,10 @@ func TestParseConfig_ValidConfigLatencyRouting_MethodLatencies_TopLevelLatencySp
},
},
},
Errors: &ErrorsConfig{Rate: DefaultErrorRate},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsCheckEnabled: true,
Errors: &ErrorsConfig{Rate: DefaultErrorRate},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsEnabled: true,
},
},

Expand All @@ -788,10 +788,10 @@ func TestParseConfig_ValidConfigLatencyRouting_MethodLatencies_TopLevelLatencySp
},
},
},
Errors: &ErrorsConfig{Rate: DefaultErrorRate},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsCheckEnabled: true,
Errors: &ErrorsConfig{Rate: DefaultErrorRate},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsEnabled: true,
}),
}

Expand Down Expand Up @@ -855,7 +855,7 @@ func TestParseConfig_ValidConfigLatencyRouting_MethodLatencies_TopLevelLatencyNo
Errors: &ErrorsConfig{Rate: DefaultErrorRate},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsCheckEnabled: true,
IsEnabled: true,
},
},

Expand All @@ -866,7 +866,7 @@ func TestParseConfig_ValidConfigLatencyRouting_MethodLatencies_TopLevelLatencyNo
Errors: &ErrorsConfig{Rate: DefaultErrorRate},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsCheckEnabled: true,
IsEnabled: true,
}),
}

Expand Down Expand Up @@ -932,10 +932,10 @@ func TestParseConfig_ValidConfigLatencyRouting_MethodLatencies_TopLevelLatencySp
},
},
},
Errors: &ErrorsConfig{Rate: DefaultErrorRate},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsCheckEnabled: true,
Errors: &ErrorsConfig{Rate: DefaultErrorRate},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsEnabled: true,
},
},

Expand All @@ -957,10 +957,10 @@ func TestParseConfig_ValidConfigLatencyRouting_MethodLatencies_TopLevelLatencySp
},
},
},
Errors: &ErrorsConfig{Rate: DefaultErrorRate},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsCheckEnabled: true,
Errors: &ErrorsConfig{Rate: DefaultErrorRate},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsEnabled: true,
}),
}

Expand Down Expand Up @@ -1064,10 +1064,10 @@ func TestParseConfig_ValidConfigLatencyRouting_MethodLatencies_TopLevelLatencyNo
},
Threshold: DefaultMaxLatency,
},
Errors: &expectedErrorsConfig,
AlwaysRoute: newBool(false),
IsInitialized: true,
IsCheckEnabled: true,
Errors: &expectedErrorsConfig,
AlwaysRoute: newBool(false),
IsInitialized: true,
IsEnabled: true,
},
},

Expand Down Expand Up @@ -1098,10 +1098,10 @@ func TestParseConfig_ValidConfigLatencyRouting_MethodLatencies_TopLevelLatencyNo
},
},
},
Errors: &expectedErrorsConfig,
AlwaysRoute: newBool(false),
IsInitialized: true,
IsCheckEnabled: true,
Errors: &expectedErrorsConfig,
AlwaysRoute: newBool(false),
IsInitialized: true,
IsEnabled: true,
}),
}

Expand Down Expand Up @@ -1170,10 +1170,10 @@ func TestParseConfig_ValidConfigLatencyRouting_NoGlobalRoutingConfig_TwoChains_O
Latency: &LatencyConfig{
MethodLatencyThresholds: map[string]time.Duration{},
},
Errors: &ErrorsConfig{Rate: 0.25},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsCheckEnabled: true,
Errors: &ErrorsConfig{Rate: 0.25},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsEnabled: true,
},
},
Chains: append(getCommonChainsConfig(&RoutingConfig{
Expand All @@ -1189,10 +1189,10 @@ func TestParseConfig_ValidConfigLatencyRouting_NoGlobalRoutingConfig_TwoChains_O
},
},
},
Errors: &ErrorsConfig{Rate: 0.25},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsCheckEnabled: true,
Errors: &ErrorsConfig{Rate: 0.25},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsEnabled: true,
}), append(getCommonChainsConfig(&RoutingConfig{
DetectionWindow: NewDuration(DefaultDetectionWindow),
BanWindow: NewDuration(DefaultBanWindow),
Expand All @@ -1207,10 +1207,10 @@ func TestParseConfig_ValidConfigLatencyRouting_NoGlobalRoutingConfig_TwoChains_O
},
},
},
Errors: &ErrorsConfig{Rate: 0.25},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsCheckEnabled: true,
Errors: &ErrorsConfig{Rate: 0.25},
AlwaysRoute: newBool(false),
IsInitialized: true,
IsEnabled: true,
}), getCommonChainsConfig(&RoutingConfig{})...)...),
}

Expand Down

0 comments on commit d861a8c

Please sign in to comment.