Skip to content

Commit

Permalink
fix(plugins): fix wrong resp when testing connections, fix a typo in …
Browse files Browse the repository at this point in the history
…bitbucket (#7137)
  • Loading branch information
d4x1 authored Mar 7, 2024
1 parent bf588be commit 197f824
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backend/plugins/bitbucket/api/blueprint_v200.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func makeDataSourcePipelinePlanV200(
}
// construct task options for Jira
task, err := helper.MakePipelinePlanTask(
"bamboo",
"bitbucket",
subtaskMetas,
scopeConfig.Entities,
tasks.BitbucketOptions{
Expand Down
6 changes: 3 additions & 3 deletions backend/plugins/opsgenie/api/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func testOpsgenieConn(ctx context.Context, connection models.OpsgenieConn) (*plu
return nil, errors.HttpStatus(http.StatusForbidden).New("API Key need 'Read' and 'Configuration access' Access rights")
}

if response.StatusCode == http.StatusOK {
if response.StatusCode == http.StatusOK || response.StatusCode == http.StatusAccepted {
return &plugin.ApiResourceOutput{Body: nil, Status: http.StatusOK}, nil
}

Expand Down Expand Up @@ -79,7 +79,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource
if testConnectionErr != nil {
return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr)
}
return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil
return testConnectionResult, nil
}

// TestConnection test opsgenie connection
Expand All @@ -101,7 +101,7 @@ func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput,
if testConnectionErr != nil {
return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr)
}
return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil
return testConnectionResult, nil
}

// @Summary create opsgenie connection
Expand Down
4 changes: 2 additions & 2 deletions backend/plugins/pagerduty/api/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput,
if testConnectionErr != nil {
return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr)
}
return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil
return testConnectionResult, nil
}

// TestExistingConnection test pagerduty connection
Expand All @@ -93,7 +93,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource
if testConnectionErr != nil {
return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr)
}
return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil
return testConnectionResult, nil
}

// @Summary create pagerduty connection
Expand Down
4 changes: 2 additions & 2 deletions backend/plugins/sonarqube/api/connection_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput,
errMsg := fmt.Sprintf("Test connection fail, unexpected status code: %d", testConnectionResult.Status)
return nil, plugin.WrapTestConnectionErrResp(basicRes, errors.Default.New(errMsg))
}
return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil
return testConnectionResult, nil
}

// TestExistingConnection test sonarqube connection options
Expand All @@ -125,7 +125,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource
errMsg := fmt.Sprintf("Test connection fail, unexpected status code: %d", testConnectionResult.Status)
return nil, plugin.WrapTestConnectionErrResp(basicRes, errors.Default.New(errMsg))
}
return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil
return testConnectionResult, nil
}

// PostConnections create sonarqube connection
Expand Down

0 comments on commit 197f824

Please sign in to comment.