-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathv2_test-optimization_SearchFlakyTests.rs
More file actions
50 lines (49 loc) · 2.32 KB
/
v2_test-optimization_SearchFlakyTests.rs
File metadata and controls
50 lines (49 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Search flaky tests returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_test_optimization::SearchFlakyTestsOptionalParams;
use datadog_api_client::datadogV2::api_test_optimization::TestOptimizationAPI;
use datadog_api_client::datadogV2::model::FlakyTestsSearchFilter;
use datadog_api_client::datadogV2::model::FlakyTestsSearchPageOptions;
use datadog_api_client::datadogV2::model::FlakyTestsSearchRequest;
use datadog_api_client::datadogV2::model::FlakyTestsSearchRequestAttributes;
use datadog_api_client::datadogV2::model::FlakyTestsSearchRequestData;
use datadog_api_client::datadogV2::model::FlakyTestsSearchRequestDataType;
use datadog_api_client::datadogV2::model::FlakyTestsSearchSort;
#[tokio::main]
async fn main() {
let body =
FlakyTestsSearchRequest
::new().data(
FlakyTestsSearchRequestData::new()
.attributes(
FlakyTestsSearchRequestAttributes::new()
.filter(
FlakyTestsSearchFilter::new()
.include_history(true)
.query(
r#"flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist""#.to_string(),
),
)
.page(
FlakyTestsSearchPageOptions::new()
.cursor(
"eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==".to_string(),
)
.limit(25),
)
.sort(FlakyTestsSearchSort::FAILURE_RATE_ASCENDING),
)
.type_(FlakyTestsSearchRequestDataType::SEARCH_FLAKY_TESTS_REQUEST),
);
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.SearchFlakyTests", true);
let api = TestOptimizationAPI::with_config(configuration);
let resp = api
.search_flaky_tests(SearchFlakyTestsOptionalParams::default().body(body))
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}