The ID of the flaky test. This is the same ID returned by the Search flaky tests endpoint and corresponds to the test_fingerprint_fqn field in test run events.
new_state [required]
enum
The new state to set for the flaky test.
Allowed enum values: active,quarantined,disabled,fixed
type [required]
enum
The definition of UpdateFlakyTestsRequestDataType object.
Allowed enum values: update_flaky_test_state_request
Summary of the update operations. Tells whether a test succeeded or failed to be updated.
attributes
object
Attributes for the update flaky test state response.
has_errors [required]
boolean
True if any errors occurred during the update operations. False if all tests succeeded to be updated.
results [required]
[object]
Results of the update operation for each test.
error
string
Error message if the update failed.
id [required]
string
The ID of the flaky test from the request. This is the same ID returned by the Search flaky tests endpoint and corresponds to the test_fingerprint_fqn field in test run events.
success [required]
boolean
True if the update was successful, False if there were any errors.
id
string
The ID of the response.
type
enum
The definition of UpdateFlakyTestsResponseDataType object.
Allowed enum values: update_flaky_test_state_response
"""
Update flaky test states returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.test_optimization_apiimportTestOptimizationApifromdatadog_api_client.v2.model.update_flaky_tests_requestimportUpdateFlakyTestsRequestfromdatadog_api_client.v2.model.update_flaky_tests_request_attributesimportUpdateFlakyTestsRequestAttributesfromdatadog_api_client.v2.model.update_flaky_tests_request_dataimportUpdateFlakyTestsRequestDatafromdatadog_api_client.v2.model.update_flaky_tests_request_data_typeimportUpdateFlakyTestsRequestDataTypefromdatadog_api_client.v2.model.update_flaky_tests_request_testimportUpdateFlakyTestsRequestTestfromdatadog_api_client.v2.model.update_flaky_tests_request_test_new_stateimportUpdateFlakyTestsRequestTestNewStatebody=UpdateFlakyTestsRequest(data=UpdateFlakyTestsRequestData(attributes=UpdateFlakyTestsRequestAttributes(tests=[UpdateFlakyTestsRequestTest(id="4eb1887a8adb1847",new_state=UpdateFlakyTestsRequestTestNewState.ACTIVE,),],),type=UpdateFlakyTestsRequestDataType.UPDATE_FLAKY_TEST_STATE_REQUEST,),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=TestOptimizationApi(api_client)response=api_instance.update_flaky_tests(body=body)print(response)
# Update flaky test states returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::TestOptimizationAPI.newbody=DatadogAPIClient::V2::UpdateFlakyTestsRequest.new({data:DatadogAPIClient::V2::UpdateFlakyTestsRequestData.new({attributes:DatadogAPIClient::V2::UpdateFlakyTestsRequestAttributes.new({tests:[DatadogAPIClient::V2::UpdateFlakyTestsRequestTest.new({id:"4eb1887a8adb1847",new_state:DatadogAPIClient::V2::UpdateFlakyTestsRequestTestNewState::ACTIVE,}),],}),type:DatadogAPIClient::V2::UpdateFlakyTestsRequestDataType::UPDATE_FLAKY_TEST_STATE_REQUEST,}),})papi_instance.update_flaky_tests(body)
// Update flaky test states returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){body:=datadogV2.UpdateFlakyTestsRequest{Data:datadogV2.UpdateFlakyTestsRequestData{Attributes:datadogV2.UpdateFlakyTestsRequestAttributes{Tests:[]datadogV2.UpdateFlakyTestsRequestTest{{Id:"4eb1887a8adb1847",NewState:datadogV2.UPDATEFLAKYTESTSREQUESTTESTNEWSTATE_ACTIVE,},},},Type:datadogV2.UPDATEFLAKYTESTSREQUESTDATATYPE_UPDATE_FLAKY_TEST_STATE_REQUEST,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewTestOptimizationApi(apiClient)resp,r,err:=api.UpdateFlakyTests(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `TestOptimizationApi.UpdateFlakyTests`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `TestOptimizationApi.UpdateFlakyTests`:\n%s\n",responseContent)}
// Update flaky test states returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_test_optimization::TestOptimizationAPI;usedatadog_api_client::datadogV2::model::UpdateFlakyTestsRequest;usedatadog_api_client::datadogV2::model::UpdateFlakyTestsRequestAttributes;usedatadog_api_client::datadogV2::model::UpdateFlakyTestsRequestData;usedatadog_api_client::datadogV2::model::UpdateFlakyTestsRequestDataType;usedatadog_api_client::datadogV2::model::UpdateFlakyTestsRequestTest;usedatadog_api_client::datadogV2::model::UpdateFlakyTestsRequestTestNewState;#[tokio::main]asyncfnmain(){letbody=UpdateFlakyTestsRequest::new(UpdateFlakyTestsRequestData::new(UpdateFlakyTestsRequestAttributes::new(vec![UpdateFlakyTestsRequestTest::new("4eb1887a8adb1847".to_string(),UpdateFlakyTestsRequestTestNewState::ACTIVE,)]),UpdateFlakyTestsRequestDataType::UPDATE_FLAKY_TEST_STATE_REQUEST,));letconfiguration=datadog::Configuration::new();letapi=TestOptimizationAPI::with_config(configuration);letresp=api.update_flaky_tests(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Update flaky test states returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.TestOptimizationApi(configuration);constparams: v2.TestOptimizationApiUpdateFlakyTestsRequest={body:{data:{attributes:{tests:[{id:"4eb1887a8adb1847",newState:"active",},],},type:"update_flaky_test_state_request",},},};apiInstance.updateFlakyTests(params).then((data: v2.UpdateFlakyTestsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));