Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions central/imageintegration/datastore/datastore_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,19 @@
return nil, nil
}

integrations, err := ds.storage.GetAll(ctx)
if err != nil {
return nil, err
if request.GetCluster() != "" {
return nil, nil

Check warning on line 56 in central/imageintegration/datastore/datastore_impl.go

View check run for this annotation

Codecov / codecov/patch

central/imageintegration/datastore/datastore_impl.go#L56

Added line #L56 was not covered by tests
}

integrationSlice := integrations[:0]
for _, integration := range integrations {
if request.GetCluster() != "" {
continue
var integrationSlice []*storage.ImageIntegration
err := ds.storage.Walk(ctx, func(integration *storage.ImageIntegration) error {
if request.GetName() == "" || request.GetName() == integration.GetName() {
integrationSlice = append(integrationSlice, integration)
}
if request.GetName() != "" && request.GetName() != integration.GetName() {
continue
}
integrationSlice = append(integrationSlice, integration)
return nil
})
if err != nil {
return nil, err

Check warning on line 67 in central/imageintegration/datastore/datastore_impl.go

View check run for this annotation

Codecov / codecov/patch

central/imageintegration/datastore/datastore_impl.go#L67

Added line #L67 was not covered by tests
}
return integrationSlice, nil
}
Expand Down
6 changes: 5 additions & 1 deletion central/imageintegration/datastore/singleton.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@

func initializeIntegrations(iiStore store.Store) {
ctx := sac.WithGlobalAccessScopeChecker(context.Background(), sac.AllowAllAccessScopeChecker())
iis, err := iiStore.GetAll(ctx)
var iis []*storage.ImageIntegration
err := iiStore.Walk(ctx, func(ii *storage.ImageIntegration) error {
iis = append(iis, ii)
return nil
})

Check warning on line 33 in central/imageintegration/datastore/singleton.go

View check run for this annotation

Codecov / codecov/patch

central/imageintegration/datastore/singleton.go#L29-L33

Added lines #L29 - L33 were not covered by tests
utils.CrashOnError(err)
// If we are starting from scratch in online-mode, add the default image integrations.
if !env.OfflineModeEnv.BooleanSetting() && len(iis) == 0 {
Expand Down
29 changes: 14 additions & 15 deletions central/imageintegration/store/mocks/store.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion central/imageintegration/store/postgres/gen.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package postgres

//go:generate pg-table-bindings-wrapper --type=storage.ImageIntegration --search-category IMAGE_INTEGRATIONS --get-all-func --cached-store
//go:generate pg-table-bindings-wrapper --type=storage.ImageIntegration --search-category IMAGE_INTEGRATIONS --cached-store
1 change: 0 additions & 1 deletion central/imageintegration/store/postgres/store.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions central/imageintegration/store/postgres/store_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion central/imageintegration/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Store interface {
Count(ctx context.Context, q *v1.Query) (int, error)
Search(ctx context.Context, q *v1.Query) ([]search.Result, error)
Get(ctx context.Context, id string) (*storage.ImageIntegration, bool, error)
GetAll(ctx context.Context) ([]*storage.ImageIntegration, error)
Walk(ctx context.Context, fn func(obj *storage.ImageIntegration) error) error
Upsert(ctx context.Context, integration *storage.ImageIntegration) error
UpsertMany(ctx context.Context, objs []*storage.ImageIntegration) error
Delete(ctx context.Context, id string) error
Expand Down
Loading