Skip to content

Commit

Permalink
fix usage of fixtures in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsinai committed Jun 27, 2024
1 parent 1e9d820 commit 6414b27
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions pkg/k8s/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,19 @@ func newFixture(t *testing.T, fixtureConfig *fixtureConfig) *fixture {
}
kubeclient := k8sfake.NewSimpleDynamicClient(runtime.NewScheme())

if fixtureConfig.portClientId == "" {
fixtureConfig.portClientId = config.ApplicationConfig.PortClientId
if fixtureConfig.portClientId != "" {
config.ApplicationConfig.PortClientId = fixtureConfig.portClientId
}
if fixtureConfig.portClientSecret == "" {
fixtureConfig.portClientSecret = config.ApplicationConfig.PortClientSecret
if fixtureConfig.portClientSecret != "" {
config.ApplicationConfig.PortClientSecret = fixtureConfig.portClientSecret
}
if fixtureConfig.stateKey == "" {
fixtureConfig.stateKey = "port-k8s-exporter/0.1"
if fixtureConfig.stateKey != "" {
config.ApplicationConfig.StateKey = fixtureConfig.stateKey
}

return &fixture{
t: t,
controller: newController(fixtureConfig.resource, fixtureConfig.objects, kubeclient, interationConfig, &config.ApplicationConfiguration{
StateKey: fixtureConfig.stateKey,
PortClientId: fixtureConfig.portClientId,
PortClientSecret: fixtureConfig.portClientSecret,
}),
t: t,
controller: newController(fixtureConfig.resource, fixtureConfig.objects, kubeclient, interationConfig, config.ApplicationConfig),
}
}

Expand Down

0 comments on commit 6414b27

Please sign in to comment.