Skip to content

Commit

Permalink
fix(backend): Allow empty namespace in pipelines. Fixes #8840. (#8859)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkcalat authored Feb 16, 2023
1 parent 1e1a020 commit 03b7752
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
12 changes: 0 additions & 12 deletions backend/src/apiserver/server/api_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,18 +280,6 @@ func toApiPipeline(pipeline *model.Pipeline) *apiv2beta1.Pipeline {
}
}

if pipeline.Namespace == "" {
return &apiv2beta1.Pipeline{
PipelineId: pipeline.UUID,
Error: util.ToRpcStatus(
util.NewInternalServerError(
errors.New("Pipeline namespace cannot be empty"),
"Failed to convert a pipeline to API pipeline",
),
),
}
}

return &apiv2beta1.Pipeline{
PipelineId: pipeline.UUID,
DisplayName: pipeline.Name,
Expand Down
22 changes: 8 additions & 14 deletions backend/src/apiserver/server/api_converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1090,13 +1090,10 @@ func TestToApiPipeline(t *testing.T) {
CreatedAtInSec: 1,
},
&apiv2beta1.Pipeline{
PipelineId: "p1",
Error: util.ToRpcStatus(
util.NewInternalServerError(
errors.New("Pipeline namespace cannot be empty"),
"Failed to convert a pipeline to API pipeline",
),
),
PipelineId: "p1",
DisplayName: "pipeline1",
Description: "This is pipeline1",
CreatedAt: &timestamppb.Timestamp{Seconds: 1},
},
},
}
Expand Down Expand Up @@ -1187,13 +1184,10 @@ func TestToApiPipelines(t *testing.T) {
),
},
{
PipelineId: "p1",
Error: util.ToRpcStatus(
util.NewInternalServerError(
errors.New("Pipeline namespace cannot be empty"),
"Failed to convert a pipeline to API pipeline",
),
),
PipelineId: "p1",
DisplayName: "pipeline1",
Description: "This is pipeline1",
CreatedAt: &timestamppb.Timestamp{Seconds: 1},
},
}
assert.Equal(t, expectedPipelines, apiPipelines)
Expand Down

0 comments on commit 03b7752

Please sign in to comment.