Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25661,6 +25661,17 @@ components:
FlakyTestsSearchFilter:
description: Search filter settings.
properties:
include_history:
default: false
description: 'Whether to include the status change history for each flaky
test in the response.

When set to true, each test will include a ''history'' array with chronological
status changes.

Defaults to false.'
example: true
type: boolean
query:
default: '*'
description: 'Search query following log syntax used to filter flaky tests,
Expand Down Expand Up @@ -25716,17 +25727,6 @@ components:
properties:
filter:
$ref: '#/components/schemas/FlakyTestsSearchFilter'
include_history:
default: false
description: 'Whether to include the status change history for each flaky
test in the response.

When set to true, each test will include a `history` array with chronological
status changes.

Defaults to false.'
example: true
type: boolean
page:
$ref: '#/components/schemas/FlakyTestsSearchPageOptions'
sort:
Expand Down
2 changes: 1 addition & 1 deletion examples/v2/test-optimization/SearchFlakyTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ public static void main(String[] args) {
new FlakyTestsSearchRequestAttributes()
.filter(
new FlakyTestsSearchFilter()
.includeHistory(true)
.query(
"""
flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"
"""))
.includeHistory(true)
.page(
new FlakyTestsSearchPageOptions()
.cursor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ public static void main(String[] args) {
new FlakyTestsSearchRequestAttributes()
.filter(
new FlakyTestsSearchFilter()
.includeHistory(true)
.query(
"""
flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"
"""))
.includeHistory(true)
.page(
new FlakyTestsSearchPageOptions()
.cursor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ public static void main(String[] args) {
.query(
"""
flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"
"""))
""")
.includeHistory(true))
.page(new FlakyTestsSearchPageOptions().limit(10L))
.sort(FlakyTestsSearchSort.FQN_ASCENDING)
.includeHistory(true))
.sort(FlakyTestsSearchSort.FQN_ASCENDING))
.type(FlakyTestsSearchRequestDataType.SEARCH_FLAKY_TESTS_REQUEST));

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,43 @@
import java.util.Objects;

/** Search filter settings. */
@JsonPropertyOrder({FlakyTestsSearchFilter.JSON_PROPERTY_QUERY})
@JsonPropertyOrder({
FlakyTestsSearchFilter.JSON_PROPERTY_INCLUDE_HISTORY,
FlakyTestsSearchFilter.JSON_PROPERTY_QUERY
})
@jakarta.annotation.Generated(
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class FlakyTestsSearchFilter {
@JsonIgnore public boolean unparsed = false;
public static final String JSON_PROPERTY_INCLUDE_HISTORY = "include_history";
private Boolean includeHistory = false;

public static final String JSON_PROPERTY_QUERY = "query";
private String query = "*";

public FlakyTestsSearchFilter includeHistory(Boolean includeHistory) {
this.includeHistory = includeHistory;
return this;
}

/**
* Whether to include the status change history for each flaky test in the response. When set to
* true, each test will include a 'history' array with chronological status changes. Defaults to
* false.
*
* @return includeHistory
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_INCLUDE_HISTORY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getIncludeHistory() {
return includeHistory;
}

public void setIncludeHistory(Boolean includeHistory) {
this.includeHistory = includeHistory;
}

public FlakyTestsSearchFilter query(String query) {
this.query = query;
return this;
Expand Down Expand Up @@ -106,19 +135,21 @@ public boolean equals(Object o) {
return false;
}
FlakyTestsSearchFilter flakyTestsSearchFilter = (FlakyTestsSearchFilter) o;
return Objects.equals(this.query, flakyTestsSearchFilter.query)
return Objects.equals(this.includeHistory, flakyTestsSearchFilter.includeHistory)
&& Objects.equals(this.query, flakyTestsSearchFilter.query)
&& Objects.equals(this.additionalProperties, flakyTestsSearchFilter.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(query, additionalProperties);
return Objects.hash(includeHistory, query, additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FlakyTestsSearchFilter {\n");
sb.append(" includeHistory: ").append(toIndentedString(includeHistory)).append("\n");
sb.append(" query: ").append(toIndentedString(query)).append("\n");
sb.append(" additionalProperties: ")
.append(toIndentedString(additionalProperties))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
/** Attributes for the flaky tests search request. */
@JsonPropertyOrder({
FlakyTestsSearchRequestAttributes.JSON_PROPERTY_FILTER,
FlakyTestsSearchRequestAttributes.JSON_PROPERTY_INCLUDE_HISTORY,
FlakyTestsSearchRequestAttributes.JSON_PROPERTY_PAGE,
FlakyTestsSearchRequestAttributes.JSON_PROPERTY_SORT
})
Expand All @@ -30,9 +29,6 @@ public class FlakyTestsSearchRequestAttributes {
public static final String JSON_PROPERTY_FILTER = "filter";
private FlakyTestsSearchFilter filter;

public static final String JSON_PROPERTY_INCLUDE_HISTORY = "include_history";
private Boolean includeHistory = false;

public static final String JSON_PROPERTY_PAGE = "page";
private FlakyTestsSearchPageOptions page;

Expand Down Expand Up @@ -61,29 +57,6 @@ public void setFilter(FlakyTestsSearchFilter filter) {
this.filter = filter;
}

public FlakyTestsSearchRequestAttributes includeHistory(Boolean includeHistory) {
this.includeHistory = includeHistory;
return this;
}

/**
* Whether to include the status change history for each flaky test in the response. When set to
* true, each test will include a <code>history</code> array with chronological status changes.
* Defaults to false.
*
* @return includeHistory
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_INCLUDE_HISTORY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getIncludeHistory() {
return includeHistory;
}

public void setIncludeHistory(Boolean includeHistory) {
this.includeHistory = includeHistory;
}

public FlakyTestsSearchRequestAttributes page(FlakyTestsSearchPageOptions page) {
this.page = page;
this.unparsed |= page.unparsed;
Expand Down Expand Up @@ -190,7 +163,6 @@ public boolean equals(Object o) {
FlakyTestsSearchRequestAttributes flakyTestsSearchRequestAttributes =
(FlakyTestsSearchRequestAttributes) o;
return Objects.equals(this.filter, flakyTestsSearchRequestAttributes.filter)
&& Objects.equals(this.includeHistory, flakyTestsSearchRequestAttributes.includeHistory)
&& Objects.equals(this.page, flakyTestsSearchRequestAttributes.page)
&& Objects.equals(this.sort, flakyTestsSearchRequestAttributes.sort)
&& Objects.equals(
Expand All @@ -199,15 +171,14 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(filter, includeHistory, page, sort, additionalProperties);
return Objects.hash(filter, page, sort, additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FlakyTestsSearchRequestAttributes {\n");
sb.append(" filter: ").append(toIndentedString(filter)).append("\n");
sb.append(" includeHistory: ").append(toIndentedString(includeHistory)).append("\n");
sb.append(" page: ").append(toIndentedString(page)).append("\n");
sb.append(" sort: ").append(toIndentedString(sort)).append("\n");
sb.append(" additionalProperties: ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Feature: Test Optimization
Scenario: Search flaky tests returns "Bad Request" response
Given operation "SearchFlakyTests" enabled
And new "SearchFlakyTests" request
And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "include_history": true, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}}
And body with value {"data": {"attributes": {"filter": {"include_history": true, "query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}}
When the request is sent
Then the response status is 400 Bad Request

Expand All @@ -29,7 +29,7 @@ Feature: Test Optimization
Scenario: Search flaky tests returns "OK" response
Given operation "SearchFlakyTests" enabled
And new "SearchFlakyTests" request
And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "include_history": true, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}}
And body with value {"data": {"attributes": {"filter": {"include_history": true, "query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}}
When the request is sent
Then the response status is 200 OK

Expand All @@ -45,7 +45,7 @@ Feature: Test Optimization
Scenario: Search flaky tests returns "OK" response with history
Given operation "SearchFlakyTests" enabled
And new "SearchFlakyTests" request
And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"limit": 10}, "sort": "fqn", "include_history": true}, "type": "search_flaky_tests_request"}}
And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\"", "include_history": true}, "page": {"limit": 10}, "sort": "fqn"}, "type": "search_flaky_tests_request"}}
When the request is sent
Then the response status is 200 OK
And the response "data[0].attributes" has field "history"
Expand All @@ -57,7 +57,7 @@ Feature: Test Optimization
Scenario: Search flaky tests returns "OK" response with pagination
Given operation "SearchFlakyTests" enabled
And new "SearchFlakyTests" request
And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "include_history": true, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}}
And body with value {"data": {"attributes": {"filter": {"include_history": true, "query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}}
When the request with pagination is sent
Then the response status is 200 OK

Expand Down
Loading