@@ -21,7 +21,7 @@ import (
2121type MicrocksClient interface {
2222 GetKeycloakURL () (string , error )
2323 SetOAuthToken (oauthToken string )
24- CreateTestResult (serviceID string , testEndpoint string , runnerType string , secretName string , timeout int64 , operationsHeaders string ) (string , error )
24+ CreateTestResult (serviceID string , testEndpoint string , runnerType string , secretName string , timeout int64 , filteredOperations string , operationsHeaders string ) (string , error )
2525 GetTestResult (testResultID string ) (* TestResultSummary , error )
2626 UploadArtifact (specificationFilePath string , mainArtifact bool ) (string , error )
2727}
@@ -122,7 +122,7 @@ func (c *microcksClient) SetOAuthToken(oauthToken string) {
122122 c .OAuthToken = oauthToken
123123}
124124
125- func (c * microcksClient ) CreateTestResult (serviceID string , testEndpoint string , runnerType string , secretName string , timeout int64 , operationsHeaders string ) (string , error ) {
125+ func (c * microcksClient ) CreateTestResult (serviceID string , testEndpoint string , runnerType string , secretName string , timeout int64 , filteredOperations string , operationsHeaders string ) (string , error ) {
126126 // Ensure we have a correct URL.
127127 rel := & url.URL {Path : "tests" }
128128 u := c .APIURL .ResolveReference (rel )
@@ -136,7 +136,10 @@ func (c *microcksClient) CreateTestResult(serviceID string, testEndpoint string,
136136 if len (secretName ) > 0 {
137137 input += (", \" secretName\" : \" " + secretName + "\" " )
138138 }
139- if len (operationsHeaders ) > 0 && ensureValid (operationsHeaders ) {
139+ if len (filteredOperations ) > 0 && ensureValidOperationsList (filteredOperations ) {
140+ input += (", \" filteredOperations\" : " + filteredOperations )
141+ }
142+ if len (operationsHeaders ) > 0 && ensureValidOperationsHeaders (operationsHeaders ) {
140143 input += (", \" operationsHeaders\" : " + operationsHeaders )
141144 }
142145
@@ -272,7 +275,18 @@ func (c *microcksClient) UploadArtifact(specificationFilePath string, mainArtifa
272275 return string (respBody ), err
273276}
274277
275- func ensureValid (operationsHeaders string ) bool {
278+ func ensureValidOperationsList (filteredOperations string ) bool {
279+ // Unmarshal using a generic interface
280+ var list = []string {}
281+ err := json .Unmarshal ([]byte (filteredOperations ), & list )
282+ if err != nil {
283+ fmt .Println ("Error parsing JSON in filteredOperations: " , err )
284+ return false
285+ }
286+ return true
287+ }
288+
289+ func ensureValidOperationsHeaders (operationsHeaders string ) bool {
276290 // Unmarshal using a generic interface
277291 var headers = map [string ][]HeaderDTO {}
278292 err := json .Unmarshal ([]byte (operationsHeaders ), & headers )
0 commit comments