Skip to content

Commit

Permalink
test refactor, reducing parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
jaroslaw-pieszka committed Oct 21, 2024
1 parent 1c86260 commit 1c95966
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cmd/broker/bind_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ func TestCreateBindingEndpoint(t *testing.T) {
}

//// api handler
bindEndpoint := broker.NewBind(*bindingCfg, db.Instances(), db.Bindings(), logs, skrK8sClientProvider, skrK8sClientProvider)
bindEndpoint := broker.NewBind(*bindingCfg, db, logs, skrK8sClientProvider, skrK8sClientProvider)
getBindingEndpoint := broker.NewGetBinding(logs, db.Bindings())
unbindEndpoint := broker.NewUnbind(logs, db.Bindings(), db.Instances(), db.Operations(), brokerBindings.NewServiceAccountBindingsManager(skrK8sClientProvider, skrK8sClientProvider))
unbindEndpoint := broker.NewUnbind(logs, db, brokerBindings.NewServiceAccountBindingsManager(skrK8sClientProvider, skrK8sClientProvider))
apiHandler := handlers.NewApiHandler(broker.KymaEnvironmentBroker{
ServicesEndpoint: nil,
ProvisionEndpoint: nil,
Expand Down
2 changes: 1 addition & 1 deletion cmd/broker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ func createAPI(router *mux.Router, servicesConfig broker.ServicesConfig, planVal
GetInstanceEndpoint: broker.NewGetInstance(cfg.Broker, db.Instances(), db.Operations(), kcBuilder, logs),
LastOperationEndpoint: broker.NewLastOperation(db.Operations(), db.InstancesArchived(), logs),
BindEndpoint: broker.NewBind(cfg.Broker.Binding, db.Instances(), db.Bindings(), logs, clientProvider, kubeconfigProvider),

Check failure on line 450 in cmd/broker/main.go

View workflow job for this annotation

GitHub Actions / run-govulncheck

too many arguments in call to broker.NewBind

Check failure on line 450 in cmd/broker/main.go

View workflow job for this annotation

GitHub Actions / run-go-linter

too many arguments in call to broker.NewBind

Check failure on line 450 in cmd/broker/main.go

View workflow job for this annotation

GitHub Actions / run-go-tests / build

too many arguments in call to broker.NewBind
UnbindEndpoint: broker.NewUnbind(logs, db.Bindings(), db.Instances(), db.Operations(), brokerBindings.NewServiceAccountBindingsManager(clientProvider, kubeconfigProvider)),
UnbindEndpoint: broker.NewUnbind(logs, db, brokerBindings.NewServiceAccountBindingsManager(clientProvider, kubeconfigProvider)),
GetBindingEndpoint: broker.NewGetBinding(logs, db.Bindings()),
LastBindingOperationEndpoint: broker.NewLastBindingOperation(logs),
}
Expand Down
6 changes: 3 additions & 3 deletions internal/broker/bind_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ type Credentials struct {
Kubeconfig string `json:"kubeconfig"`
}

func NewBind(cfg BindingConfig, instanceStorage storage.Instances, bindingsStorage storage.Bindings, log logrus.FieldLogger, clientProvider broker.ClientProvider, kubeconfigProvider broker.KubeconfigProvider) *BindEndpoint {
func NewBind(cfg BindingConfig, db storage.BrokerStorage, log logrus.FieldLogger, clientProvider broker.ClientProvider, kubeconfigProvider broker.KubeconfigProvider) *BindEndpoint {
return &BindEndpoint{config: cfg,
instancesStorage: instanceStorage,
bindingsStorage: bindingsStorage,
instancesStorage: db.Instances(),
bindingsStorage: db.Bindings(),
log: log.WithField("service", "BindEndpoint"),
serviceAccountBindingManager: broker.NewServiceAccountBindingsManager(clientProvider, kubeconfigProvider),
}
Expand Down
4 changes: 2 additions & 2 deletions internal/broker/bind_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ type UnbindEndpoint struct {
bindingsManager broker.BindingsManager
}

func NewUnbind(log logrus.FieldLogger, bindingsStorage storage.Bindings, instancesStorage storage.Instances, operationsStorage storage.Operations, bindingsManager broker.BindingsManager) *UnbindEndpoint {
return &UnbindEndpoint{log: log.WithField("service", "UnbindEndpoint"), bindingsStorage: bindingsStorage, instancesStorage: instancesStorage, bindingsManager: bindingsManager, operationsStorage: operationsStorage}
func NewUnbind(log logrus.FieldLogger, db storage.BrokerStorage, bindingsManager broker.BindingsManager) *UnbindEndpoint {
return &UnbindEndpoint{log: log.WithField("service", "UnbindEndpoint"), bindingsStorage: db.Bindings(), instancesStorage: db.Instances(), bindingsManager: bindingsManager, operationsStorage: db.Operations()}
}

// Unbind deletes an existing service binding
Expand Down

0 comments on commit 1c95966

Please sign in to comment.