MCPcopy Index your code
hub / github.com/apache/devlake / TestConnection

Function TestConnection

backend/plugins/sonarqube/api/connection_api.go:88–104  ·  view source on GitHub ↗

TestConnection test sonarqube connection options @Summary test sonarqube connection @Description Test sonarqube Connection @Tags plugins/sonarqube @Param body body models.SonarqubeConn true "json body" @Success 200 {object} SonarqubeTestConnResponse "Success" @Failure 400 {string} errcode.Error "B

(input *plugin.ApiResourceInput)

Source from the content-addressed store, hash-verified

86// @Failure 500 {string} errcode.Error "Internal Error"
87// @Router /plugins/sonarqube/test [POST]
88func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
89 // decode
90 var err errors.Error
91 var connection models.SonarqubeConn
92 if err = api.Decode(input.Body, &connection, vld); err != nil {
93 return nil, err
94 }
95 testConnectionResult, testConnectionErr := testConnection(context.TODO(), connection)
96 if testConnectionErr != nil {
97 return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr)
98 }
99 if testConnectionResult.Status != http.StatusOK {
100 errMsg := fmt.Sprintf("Test connection fail, unexpected status code: %d", testConnectionResult.Status)
101 return nil, plugin.WrapTestConnectionErrResp(basicRes, errors.Default.New(errMsg))
102 }
103 return testConnectionResult, nil
104}
105
106// TestExistingConnection test sonarqube connection options
107// @Summary test sonarqube connection

Callers

nothing calls this directly

Calls 2

testConnectionFunction · 0.70
NewMethod · 0.65

Tested by

no test coverage detected