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.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
data: DatadogAPIClient::V2::FlakyTestsSearchRequestData.new({
attributes: DatadogAPIClient::V2::FlakyTestsSearchRequestAttributes.new({
filter: DatadogAPIClient::V2::FlakyTestsSearchFilter.new({
include_history: true,
query: 'flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"',
}),
include_history: true,
page: DatadogAPIClient::V2::FlakyTestsSearchPageOptions.new({
cursor: "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
limit: 25,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
data: DatadogAPIClient::V2::FlakyTestsSearchRequestData.new({
attributes: DatadogAPIClient::V2::FlakyTestsSearchRequestAttributes.new({
filter: DatadogAPIClient::V2::FlakyTestsSearchFilter.new({
include_history: true,
query: 'flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"',
}),
include_history: true,
page: DatadogAPIClient::V2::FlakyTestsSearchPageOptions.new({
cursor: "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
limit: 25,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
attributes: DatadogAPIClient::V2::FlakyTestsSearchRequestAttributes.new({
filter: DatadogAPIClient::V2::FlakyTestsSearchFilter.new({
query: 'flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"',
include_history: true,
}),
page: DatadogAPIClient::V2::FlakyTestsSearchPageOptions.new({
limit: 10,
}),
sort: DatadogAPIClient::V2::FlakyTestsSearchSort::FQN_ASCENDING,
include_history: true,
}),
type: DatadogAPIClient::V2::FlakyTestsSearchRequestDataType::SEARCH_FLAKY_TESTS_REQUEST,
}),
Expand Down
8 changes: 4 additions & 4 deletions features/v2/test_optimization.feature
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
14 changes: 13 additions & 1 deletion lib/datadog_api_client/v2/models/flaky_tests_search_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ module DatadogAPIClient::V2
class FlakyTestsSearchFilter
include BaseGenericModel

# 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.
attr_accessor :include_history

# Search query following log syntax used to filter flaky tests, same as on Flaky Tests Management UI. The supported search keys are:
# - `flaky_test_state`
# - `flaky_test_category`
Expand All @@ -40,6 +45,7 @@ class FlakyTestsSearchFilter
# @!visibility private
def self.attribute_map
{
:'include_history' => :'include_history',
:'query' => :'query'
}
end
Expand All @@ -48,6 +54,7 @@ def self.attribute_map
# @!visibility private
def self.openapi_types
{
:'include_history' => :'Boolean',
:'query' => :'String'
}
end
Expand All @@ -70,6 +77,10 @@ def initialize(attributes = {})
end
}

if attributes.key?(:'include_history')
self.include_history = attributes[:'include_history']
end

if attributes.key?(:'query')
self.query = attributes[:'query']
end
Expand Down Expand Up @@ -101,6 +112,7 @@ def to_hash
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
include_history == o.include_history &&
query == o.query &&
additional_properties == o.additional_properties
end
Expand All @@ -109,7 +121,7 @@ def ==(o)
# @return [Integer] Hash code
# @!visibility private
def hash
[query, additional_properties].hash
[include_history, query, additional_properties].hash
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ class FlakyTestsSearchRequestAttributes
# Search filter settings.
attr_accessor :filter

# 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.
attr_accessor :include_history

# Pagination attributes for listing flaky tests.
attr_accessor :page

Expand All @@ -42,7 +37,6 @@ class FlakyTestsSearchRequestAttributes
def self.attribute_map
{
:'filter' => :'filter',
:'include_history' => :'include_history',
:'page' => :'page',
:'sort' => :'sort'
}
Expand All @@ -53,7 +47,6 @@ def self.attribute_map
def self.openapi_types
{
:'filter' => :'FlakyTestsSearchFilter',
:'include_history' => :'Boolean',
:'page' => :'FlakyTestsSearchPageOptions',
:'sort' => :'FlakyTestsSearchSort'
}
Expand Down Expand Up @@ -81,10 +74,6 @@ def initialize(attributes = {})
self.filter = attributes[:'filter']
end

if attributes.key?(:'include_history')
self.include_history = attributes[:'include_history']
end

if attributes.key?(:'page')
self.page = attributes[:'page']
end
Expand Down Expand Up @@ -121,7 +110,6 @@ def ==(o)
return true if self.equal?(o)
self.class == o.class &&
filter == o.filter &&
include_history == o.include_history &&
page == o.page &&
sort == o.sort &&
additional_properties == o.additional_properties
Expand All @@ -131,7 +119,7 @@ def ==(o)
# @return [Integer] Hash code
# @!visibility private
def hash
[filter, include_history, page, sort, additional_properties].hash
[filter, page, sort, additional_properties].hash
end
end
end
Loading