1 Commits

Author SHA1 Message Date
469f3f2c38 chore: change license to MIT 2026-01-13 20:16:19 +08:00
2 changed files with 2 additions and 24 deletions

View File

@@ -131,9 +131,6 @@ func (c *HTTPClient) GetRunnerStats(
) (*RunnerStats, error) { ) (*RunnerStats, error) {
switch scope { switch scope {
case v1alpha1.RunnerGroupScopeRepo: case v1alpha1.RunnerGroupScopeRepo:
if user != "" {
return c.getRunnerStatsForRepo(ctx, giteaURL, authToken, user, repo, labels)
}
return c.getRunnerStatsForRepo(ctx, giteaURL, authToken, org, repo, labels) return c.getRunnerStatsForRepo(ctx, giteaURL, authToken, org, repo, labels)
case v1alpha1.RunnerGroupScopeOrg: case v1alpha1.RunnerGroupScopeOrg:
return c.getRunnerStatsForOrg(ctx, giteaURL, authToken, org, labels) return c.getRunnerStatsForOrg(ctx, giteaURL, authToken, org, labels)

View File

@@ -80,21 +80,6 @@ func TestHTTPClient_GetRunnerStats(t *testing.T) {
expectedQueued: 0, // No runner capabilities provided -> no match expectedQueued: 0, // No runner capabilities provided -> no match
expectedError: false, expectedError: false,
}, },
{
name: "repo scope (user owned)",
scope: v1alpha1.RunnerGroupScopeRepo,
user: "testuser",
repo: "testrepo",
labels: []string{"linux"},
mockResponse: ActionWorkflowJobsResponse{
TotalCount: 1,
Jobs: []ActionWorkflowJob{
{ID: 1, Status: "queued", Labels: []string{"linux"}},
},
},
expectedQueued: 1,
expectedError: false,
},
{ {
name: "global scope with specific labels", name: "global scope with specific labels",
scope: v1alpha1.RunnerGroupScopeGlobal, scope: v1alpha1.RunnerGroupScopeGlobal,
@@ -150,13 +135,9 @@ func TestHTTPClient_GetRunnerStats(t *testing.T) {
expectedPath := "" expectedPath := ""
switch tt.scope { switch tt.scope {
case v1alpha1.RunnerGroupScopeRepo: case v1alpha1.RunnerGroupScopeRepo:
owner := tt.org expectedPath = "/api/v1/repos/testorg/testrepo/actions/jobs"
if tt.user != "" {
owner = tt.user
}
expectedPath = "/api/v1/repos/" + owner + "/" + tt.repo + "/actions/jobs"
case v1alpha1.RunnerGroupScopeOrg: case v1alpha1.RunnerGroupScopeOrg:
expectedPath = "/api/v1/orgs/" + tt.org + "/actions/jobs" expectedPath = "/api/v1/orgs/testorg/actions/jobs"
case v1alpha1.RunnerGroupScopeGlobal: case v1alpha1.RunnerGroupScopeGlobal:
expectedPath = "/api/v1/admin/actions/jobs" expectedPath = "/api/v1/admin/actions/jobs"
case v1alpha1.RunnerGroupScopeUser: case v1alpha1.RunnerGroupScopeUser: