Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/tm gitlab pagination #232

Merged
merged 12 commits into from
Dec 16, 2024
Prev Previous commit
Next Next commit
chore: rename back to fetchFileList
y-eight committed Dec 11, 2024
commit 713ea063f95f5a23384173ff7177552e0125c00f
6 changes: 3 additions & 3 deletions pkg/sparrow/targets/remote/gitlab/gitlab.go
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@ func New(cfg Config) remote.Interactor {
// FetchFiles fetches the files from the global targets repository from the configured gitlab repository
func (c *client) FetchFiles(ctx context.Context) ([]checks.GlobalTarget, error) {
log := logger.FromContext(ctx)
fl, err := c.fetchFiles(ctx)
fl, err := c.fetchFileList(ctx)
if err != nil {
log.ErrorContext(ctx, "Failed to fetch files", "error", err)
return nil, err
@@ -143,9 +143,9 @@ func (c *client) fetchFile(ctx context.Context, f string) (checks.GlobalTarget,
return res, nil
}

// fetchFiles fetches the filenames from the global targets repository from the configured gitlab repository,
// fetchFileList fetches the filenames from the global targets repository from the configured gitlab repository,
// so they may be fetched individually
func (c *client) fetchFiles(ctx context.Context) ([]string, error) {
func (c *client) fetchFileList(ctx context.Context) ([]string, error) {
log := logger.FromContext(ctx)
log.DebugContext(ctx, "Preparing fetching file list from gitlab")

2 changes: 1 addition & 1 deletion pkg/sparrow/targets/remote/gitlab/gitlab_test.go
Original file line number Diff line number Diff line change
@@ -119,7 +119,7 @@ func Test_gitlab_fetchFileList(t *testing.T) {
},
client: http.DefaultClient,
}
got, err := g.fetchFiles(context.Background())
got, err := g.fetchFileList(context.Background())
if (err != nil) != tt.wantErr {
t.Fatalf("FetchFiles() error = %v, wantErr %v", err, tt.wantErr)
}