Skip to content

Commit

Permalink
fixed a bunch of issues following recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mvisonneau committed May 22, 2023
1 parent 90444f1 commit 413855e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/projects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestPullProjectsFromWildcard(t *testing.T) {

mux.HandleFunc("/api/v4/projects",
func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, `[{"id":1,"path_with_namespace":"foo","jobs_enabled":false},{"id":2,"path_with_namespace":"bar","jobs_enabled":true}]`)
fmt.Fprint(w, `[{"id":2,"path_with_namespace":"bar","jobs_enabled":true}]`)
})

w := config.NewWildcard()
Expand Down
2 changes: 1 addition & 1 deletion pkg/gitlab/environments.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (c *Client) GetEnvironment(
"project-name": project,
"environment-name": e.Name,
}).
Warn("no deployments found for the environment")
Debug("no deployments found for the environment")

return
}
Expand Down
9 changes: 0 additions & 9 deletions pkg/gitlab/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,6 @@ func (c *Client) ListProjects(ctx context.Context, w config.Wildcard) ([]schemas
continue
}

if !gp.JobsEnabled {
log.WithFields(logFields).WithFields(log.Fields{
"project-id": gp.ID,
"project-name": gp.PathWithNamespace,
}).Debug("jobs/pipelines not enabled on project, skipping")

continue
}

p := schemas.NewProject(gp.PathWithNamespace)
p.ProjectParameters = w.ProjectParameters
projects = append(projects, p)
Expand Down
6 changes: 3 additions & 3 deletions pkg/gitlab/projects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestListUserProjects(t *testing.T) {
mux.HandleFunc(fmt.Sprintf("/api/v4/users/%s/projects", w.Owner.Name),
func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, r.Method, "GET")
fmt.Fprint(w, `[{"id":1,"path_with_namespace":"foo/bar","jobs_enabled":true},{"id":2,"path_with_namespace":"bar/baz","jobs_enabled":true}]`)
fmt.Fprint(w, `[{"id":1,"path_with_namespace":"foo/bar"},{"id":2,"path_with_namespace":"bar/baz"}]`)
})

projects, err := c.ListProjects(ctx, w)
Expand All @@ -70,7 +70,7 @@ func TestListGroupProjects(t *testing.T) {
mux.HandleFunc(fmt.Sprintf("/api/v4/groups/%s/projects", w.Owner.Name),
func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, r.Method, "GET")
fmt.Fprint(w, `[{"id":1,"path_with_namespace":"foo/bar","jobs_enabled":true},{"id":2,"path_with_namespace":"bar/baz","jobs_enabled":true}]`)
fmt.Fprint(w, `[{"id":1,"path_with_namespace":"foo/bar"},{"id":2,"path_with_namespace":"bar/baz"}]`)
})

projects, err := c.ListProjects(ctx, w)
Expand All @@ -96,7 +96,7 @@ func TestListProjects(t *testing.T) {
mux.HandleFunc("/api/v4/projects",
func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, r.Method, "GET")
fmt.Fprint(w, `[{"id":1,"path_with_namespace":"foo","jobs_enabled":false},{"id":2,"path_with_namespace":"bar","jobs_enabled":true}]`)
fmt.Fprint(w, `[{"id":2,"path_with_namespace":"bar"}]`)
})

projects, err := c.ListProjects(ctx, w)
Expand Down

0 comments on commit 413855e

Please sign in to comment.