diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e83df8269e5..8d4963e55a6 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -26216,9 +26216,18 @@ components: Includes state transitions like new -> quarantined -> fixed, along with the associated commit SHA when available. example: - commit_sha: abc123def456 + policy_id: ftm_policy.quarantine.failure_rate + policy_meta: + config: + failure_rate: 0.1 + required_runs: 100 + failure_rate: 0.25 + total_runs: 200 status: quarantined timestamp: 1704067200000 - commit_sha: "" + policy_id: unknown + policy_meta: status: new timestamp: 1703980800000 items: @@ -26288,6 +26297,11 @@ components: description: The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available. example: abc123def456 type: string + policy_id: + $ref: "#/components/schemas/FlakyTestHistoryPolicyId" + policy_meta: + $ref: "#/components/schemas/FlakyTestHistoryPolicyMeta" + nullable: true status: description: The test status at this point in history. example: quarantined @@ -26302,6 +26316,131 @@ components: - commit_sha - timestamp type: object + FlakyTestHistoryPolicyId: + description: The policy that triggered this status change. + enum: + - ftm_policy.manual + - ftm_policy.fixed + - ftm_policy.disable.failure_rate + - ftm_policy.disable.branch_flake + - ftm_policy.disable.days_active + - ftm_policy.quarantine.failure_rate + - ftm_policy.quarantine.branch_flake + - ftm_policy.quarantine.days_active + - unknown + example: ftm_policy.quarantine.failure_rate + nullable: false + type: string + x-enum-varnames: + - MANUAL + - FIXED + - DISABLE_FAILURE_RATE + - DISABLE_BRANCH_FLAKE + - DISABLE_DAYS_ACTIVE + - QUARANTINE_FAILURE_RATE + - QUARANTINE_BRANCH_FLAKE + - QUARANTINE_DAYS_ACTIVE + - UNKNOWN + FlakyTestHistoryPolicyMeta: + description: Metadata about the policy that triggered this status change. + properties: + branches: + description: Branches where the test was flaky at the time of the status change. + example: ["main", "develop"] + items: + type: string + nullable: true + type: array + config: + $ref: "#/components/schemas/FlakyTestHistoryPolicyMetaConfig" + nullable: true + days_active: + description: The number of days the test has been active at the time of the status change. + example: 15 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + days_without_flake: + description: The number of days since the test last exhibited flakiness. + example: 30 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + failure_rate: + description: The failure rate of the test at the time of the status change. + example: 0.25 + format: double + maximum: 1 + minimum: 0 + nullable: true + type: number + state: + description: The previous state of the test. + example: quarantined + nullable: true + type: string + total_runs: + description: The total number of test runs at the time of the status change. + example: 200 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + type: object + FlakyTestHistoryPolicyMetaConfig: + description: Configuration parameters of the policy that triggered this status change. + properties: + branches: + description: The branches considered by the policy. + example: ["main"] + items: + type: string + nullable: true + type: array + days_active: + description: The number of days a test must have been active for the policy to trigger. + example: 30 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + failure_rate: + description: The failure rate threshold for the policy to trigger. + example: 0.7 + format: double + maximum: 1 + minimum: 0 + nullable: true + type: number + forget_branches: + description: Branches excluded from the policy evaluation. + example: ["release"] + items: + type: string + nullable: true + type: array + required_runs: + description: The minimum number of test runs required for the policy to trigger. + example: 100 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + state: + description: The target state the policy transitions the test from. + example: quarantined + nullable: true + type: string + test_services: + description: Test services excluded from the policy evaluation. + example: ["my-service"] + items: + type: string + nullable: true + type: array + type: object FlakyTestPipelineStats: description: CI pipeline related statistics for the flaky test. This information is only available if test runs are associated with CI pipeline events from CI Visibility. properties: @@ -26381,6 +26520,14 @@ 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: |- @@ -26426,14 +26573,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: diff --git a/examples/v2/test-optimization/SearchFlakyTests.java b/examples/v2/test-optimization/SearchFlakyTests.java index 58650a27895..4c356007fa5 100644 --- a/examples/v2/test-optimization/SearchFlakyTests.java +++ b/examples/v2/test-optimization/SearchFlakyTests.java @@ -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( diff --git a/examples/v2/test-optimization/SearchFlakyTests_1224086727.java b/examples/v2/test-optimization/SearchFlakyTests_1224086727.java index 164ee6fe99f..cb08200d7fa 100644 --- a/examples/v2/test-optimization/SearchFlakyTests_1224086727.java +++ b/examples/v2/test-optimization/SearchFlakyTests_1224086727.java @@ -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( diff --git a/examples/v2/test-optimization/SearchFlakyTests_209064879.java b/examples/v2/test-optimization/SearchFlakyTests_209064879.java index f1b3d1462bc..ebef8c47cf2 100644 --- a/examples/v2/test-optimization/SearchFlakyTests_209064879.java +++ b/examples/v2/test-optimization/SearchFlakyTests_209064879.java @@ -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 { diff --git a/src/main/java/com/datadog/api/client/v2/model/FlakyTestHistory.java b/src/main/java/com/datadog/api/client/v2/model/FlakyTestHistory.java index e99e13440fa..95cbd75cd4b 100644 --- a/src/main/java/com/datadog/api/client/v2/model/FlakyTestHistory.java +++ b/src/main/java/com/datadog/api/client/v2/model/FlakyTestHistory.java @@ -20,6 +20,8 @@ /** A single history entry representing a status change for a flaky test. */ @JsonPropertyOrder({ FlakyTestHistory.JSON_PROPERTY_COMMIT_SHA, + FlakyTestHistory.JSON_PROPERTY_POLICY_ID, + FlakyTestHistory.JSON_PROPERTY_POLICY_META, FlakyTestHistory.JSON_PROPERTY_STATUS, FlakyTestHistory.JSON_PROPERTY_TIMESTAMP }) @@ -30,6 +32,12 @@ public class FlakyTestHistory { public static final String JSON_PROPERTY_COMMIT_SHA = "commit_sha"; private String commitSha; + public static final String JSON_PROPERTY_POLICY_ID = "policy_id"; + private FlakyTestHistoryPolicyId policyId; + + public static final String JSON_PROPERTY_POLICY_META = "policy_meta"; + private FlakyTestHistoryPolicyMeta policyMeta; + public static final String JSON_PROPERTY_STATUS = "status"; private String status; @@ -69,6 +77,53 @@ public void setCommitSha(String commitSha) { this.commitSha = commitSha; } + public FlakyTestHistory policyId(FlakyTestHistoryPolicyId policyId) { + this.policyId = policyId; + this.unparsed |= !policyId.isValid(); + return this; + } + + /** + * The policy that triggered this status change. + * + * @return policyId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_POLICY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FlakyTestHistoryPolicyId getPolicyId() { + return policyId; + } + + public void setPolicyId(FlakyTestHistoryPolicyId policyId) { + if (!policyId.isValid()) { + this.unparsed = true; + } + this.policyId = policyId; + } + + public FlakyTestHistory policyMeta(FlakyTestHistoryPolicyMeta policyMeta) { + this.policyMeta = policyMeta; + this.unparsed |= policyMeta.unparsed; + return this; + } + + /** + * Metadata about the policy that triggered this status change. + * + * @return policyMeta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_POLICY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FlakyTestHistoryPolicyMeta getPolicyMeta() { + return policyMeta; + } + + public void setPolicyMeta(FlakyTestHistoryPolicyMeta policyMeta) { + this.policyMeta = policyMeta; + } + public FlakyTestHistory status(String status) { this.status = status; return this; @@ -166,6 +221,8 @@ public boolean equals(Object o) { } FlakyTestHistory flakyTestHistory = (FlakyTestHistory) o; return Objects.equals(this.commitSha, flakyTestHistory.commitSha) + && Objects.equals(this.policyId, flakyTestHistory.policyId) + && Objects.equals(this.policyMeta, flakyTestHistory.policyMeta) && Objects.equals(this.status, flakyTestHistory.status) && Objects.equals(this.timestamp, flakyTestHistory.timestamp) && Objects.equals(this.additionalProperties, flakyTestHistory.additionalProperties); @@ -173,7 +230,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(commitSha, status, timestamp, additionalProperties); + return Objects.hash(commitSha, policyId, policyMeta, status, timestamp, additionalProperties); } @Override @@ -181,6 +238,8 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class FlakyTestHistory {\n"); sb.append(" commitSha: ").append(toIndentedString(commitSha)).append("\n"); + sb.append(" policyId: ").append(toIndentedString(policyId)).append("\n"); + sb.append(" policyMeta: ").append(toIndentedString(policyMeta)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); sb.append(" additionalProperties: ") diff --git a/src/main/java/com/datadog/api/client/v2/model/FlakyTestHistoryPolicyId.java b/src/main/java/com/datadog/api/client/v2/model/FlakyTestHistoryPolicyId.java new file mode 100644 index 00000000000..650af2bc0c6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FlakyTestHistoryPolicyId.java @@ -0,0 +1,82 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The policy that triggered this status change. */ +@JsonSerialize(using = FlakyTestHistoryPolicyId.FlakyTestHistoryPolicyIdSerializer.class) +public class FlakyTestHistoryPolicyId extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "ftm_policy.manual", + "ftm_policy.fixed", + "ftm_policy.disable.failure_rate", + "ftm_policy.disable.branch_flake", + "ftm_policy.disable.days_active", + "ftm_policy.quarantine.failure_rate", + "ftm_policy.quarantine.branch_flake", + "ftm_policy.quarantine.days_active", + "unknown")); + + public static final FlakyTestHistoryPolicyId MANUAL = + new FlakyTestHistoryPolicyId("ftm_policy.manual"); + public static final FlakyTestHistoryPolicyId FIXED = + new FlakyTestHistoryPolicyId("ftm_policy.fixed"); + public static final FlakyTestHistoryPolicyId DISABLE_FAILURE_RATE = + new FlakyTestHistoryPolicyId("ftm_policy.disable.failure_rate"); + public static final FlakyTestHistoryPolicyId DISABLE_BRANCH_FLAKE = + new FlakyTestHistoryPolicyId("ftm_policy.disable.branch_flake"); + public static final FlakyTestHistoryPolicyId DISABLE_DAYS_ACTIVE = + new FlakyTestHistoryPolicyId("ftm_policy.disable.days_active"); + public static final FlakyTestHistoryPolicyId QUARANTINE_FAILURE_RATE = + new FlakyTestHistoryPolicyId("ftm_policy.quarantine.failure_rate"); + public static final FlakyTestHistoryPolicyId QUARANTINE_BRANCH_FLAKE = + new FlakyTestHistoryPolicyId("ftm_policy.quarantine.branch_flake"); + public static final FlakyTestHistoryPolicyId QUARANTINE_DAYS_ACTIVE = + new FlakyTestHistoryPolicyId("ftm_policy.quarantine.days_active"); + public static final FlakyTestHistoryPolicyId UNKNOWN = new FlakyTestHistoryPolicyId("unknown"); + + FlakyTestHistoryPolicyId(String value) { + super(value, allowedValues); + } + + public static class FlakyTestHistoryPolicyIdSerializer + extends StdSerializer { + public FlakyTestHistoryPolicyIdSerializer(Class t) { + super(t); + } + + public FlakyTestHistoryPolicyIdSerializer() { + this(null); + } + + @Override + public void serialize( + FlakyTestHistoryPolicyId value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FlakyTestHistoryPolicyId fromValue(String value) { + return new FlakyTestHistoryPolicyId(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FlakyTestHistoryPolicyMeta.java b/src/main/java/com/datadog/api/client/v2/model/FlakyTestHistoryPolicyMeta.java new file mode 100644 index 00000000000..917ab68908a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FlakyTestHistoryPolicyMeta.java @@ -0,0 +1,385 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Metadata about the policy that triggered this status change. */ +@JsonPropertyOrder({ + FlakyTestHistoryPolicyMeta.JSON_PROPERTY_BRANCHES, + FlakyTestHistoryPolicyMeta.JSON_PROPERTY_CONFIG, + FlakyTestHistoryPolicyMeta.JSON_PROPERTY_DAYS_ACTIVE, + FlakyTestHistoryPolicyMeta.JSON_PROPERTY_DAYS_WITHOUT_FLAKE, + FlakyTestHistoryPolicyMeta.JSON_PROPERTY_FAILURE_RATE, + FlakyTestHistoryPolicyMeta.JSON_PROPERTY_STATE, + FlakyTestHistoryPolicyMeta.JSON_PROPERTY_TOTAL_RUNS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FlakyTestHistoryPolicyMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BRANCHES = "branches"; + private JsonNullable> branches = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_CONFIG = "config"; + private FlakyTestHistoryPolicyMetaConfig config; + + public static final String JSON_PROPERTY_DAYS_ACTIVE = "days_active"; + private JsonNullable daysActive = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DAYS_WITHOUT_FLAKE = "days_without_flake"; + private JsonNullable daysWithoutFlake = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_FAILURE_RATE = "failure_rate"; + private JsonNullable failureRate = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_STATE = "state"; + private JsonNullable state = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_TOTAL_RUNS = "total_runs"; + private JsonNullable totalRuns = JsonNullable.undefined(); + + public FlakyTestHistoryPolicyMeta branches(List branches) { + this.branches = JsonNullable.>of(branches); + return this; + } + + public FlakyTestHistoryPolicyMeta addBranchesItem(String branchesItem) { + if (this.branches == null || !this.branches.isPresent()) { + this.branches = JsonNullable.>of(new ArrayList<>()); + } + try { + this.branches.get().add(branchesItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Branches where the test was flaky at the time of the status change. + * + * @return branches + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getBranches() { + return branches.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_BRANCHES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getBranches_JsonNullable() { + return branches; + } + + @JsonProperty(JSON_PROPERTY_BRANCHES) + public void setBranches_JsonNullable(JsonNullable> branches) { + this.branches = branches; + } + + public void setBranches(List branches) { + this.branches = JsonNullable.>of(branches); + } + + public FlakyTestHistoryPolicyMeta config(FlakyTestHistoryPolicyMetaConfig config) { + this.config = config; + this.unparsed |= config.unparsed; + return this; + } + + /** + * Configuration parameters of the policy that triggered this status change. + * + * @return config + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONFIG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FlakyTestHistoryPolicyMetaConfig getConfig() { + return config; + } + + public void setConfig(FlakyTestHistoryPolicyMetaConfig config) { + this.config = config; + } + + public FlakyTestHistoryPolicyMeta daysActive(Integer daysActive) { + this.daysActive = JsonNullable.of(daysActive); + return this; + } + + /** + * The number of days the test has been active at the time of the status change. maximum: + * 2147483647 + * + * @return daysActive + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Integer getDaysActive() { + return daysActive.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DAYS_ACTIVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDaysActive_JsonNullable() { + return daysActive; + } + + @JsonProperty(JSON_PROPERTY_DAYS_ACTIVE) + public void setDaysActive_JsonNullable(JsonNullable daysActive) { + this.daysActive = daysActive; + } + + public void setDaysActive(Integer daysActive) { + this.daysActive = JsonNullable.of(daysActive); + } + + public FlakyTestHistoryPolicyMeta daysWithoutFlake(Integer daysWithoutFlake) { + this.daysWithoutFlake = JsonNullable.of(daysWithoutFlake); + return this; + } + + /** + * The number of days since the test last exhibited flakiness. maximum: 2147483647 + * + * @return daysWithoutFlake + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Integer getDaysWithoutFlake() { + return daysWithoutFlake.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DAYS_WITHOUT_FLAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDaysWithoutFlake_JsonNullable() { + return daysWithoutFlake; + } + + @JsonProperty(JSON_PROPERTY_DAYS_WITHOUT_FLAKE) + public void setDaysWithoutFlake_JsonNullable(JsonNullable daysWithoutFlake) { + this.daysWithoutFlake = daysWithoutFlake; + } + + public void setDaysWithoutFlake(Integer daysWithoutFlake) { + this.daysWithoutFlake = JsonNullable.of(daysWithoutFlake); + } + + public FlakyTestHistoryPolicyMeta failureRate(Double failureRate) { + this.failureRate = JsonNullable.of(failureRate); + return this; + } + + /** + * The failure rate of the test at the time of the status change. minimum: 0 maximum: 1 + * + * @return failureRate + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Double getFailureRate() { + return failureRate.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_FAILURE_RATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getFailureRate_JsonNullable() { + return failureRate; + } + + @JsonProperty(JSON_PROPERTY_FAILURE_RATE) + public void setFailureRate_JsonNullable(JsonNullable failureRate) { + this.failureRate = failureRate; + } + + public void setFailureRate(Double failureRate) { + this.failureRate = JsonNullable.of(failureRate); + } + + public FlakyTestHistoryPolicyMeta state(String state) { + this.state = JsonNullable.of(state); + return this; + } + + /** + * The previous state of the test. + * + * @return state + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getState() { + return state.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getState_JsonNullable() { + return state; + } + + @JsonProperty(JSON_PROPERTY_STATE) + public void setState_JsonNullable(JsonNullable state) { + this.state = state; + } + + public void setState(String state) { + this.state = JsonNullable.of(state); + } + + public FlakyTestHistoryPolicyMeta totalRuns(Integer totalRuns) { + this.totalRuns = JsonNullable.of(totalRuns); + return this; + } + + /** + * The total number of test runs at the time of the status change. maximum: 2147483647 + * + * @return totalRuns + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Integer getTotalRuns() { + return totalRuns.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TOTAL_RUNS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getTotalRuns_JsonNullable() { + return totalRuns; + } + + @JsonProperty(JSON_PROPERTY_TOTAL_RUNS) + public void setTotalRuns_JsonNullable(JsonNullable totalRuns) { + this.totalRuns = totalRuns; + } + + public void setTotalRuns(Integer totalRuns) { + this.totalRuns = JsonNullable.of(totalRuns); + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FlakyTestHistoryPolicyMeta + */ + @JsonAnySetter + public FlakyTestHistoryPolicyMeta putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FlakyTestHistoryPolicyMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FlakyTestHistoryPolicyMeta flakyTestHistoryPolicyMeta = (FlakyTestHistoryPolicyMeta) o; + return Objects.equals(this.branches, flakyTestHistoryPolicyMeta.branches) + && Objects.equals(this.config, flakyTestHistoryPolicyMeta.config) + && Objects.equals(this.daysActive, flakyTestHistoryPolicyMeta.daysActive) + && Objects.equals(this.daysWithoutFlake, flakyTestHistoryPolicyMeta.daysWithoutFlake) + && Objects.equals(this.failureRate, flakyTestHistoryPolicyMeta.failureRate) + && Objects.equals(this.state, flakyTestHistoryPolicyMeta.state) + && Objects.equals(this.totalRuns, flakyTestHistoryPolicyMeta.totalRuns) + && Objects.equals( + this.additionalProperties, flakyTestHistoryPolicyMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + branches, + config, + daysActive, + daysWithoutFlake, + failureRate, + state, + totalRuns, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FlakyTestHistoryPolicyMeta {\n"); + sb.append(" branches: ").append(toIndentedString(branches)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" daysActive: ").append(toIndentedString(daysActive)).append("\n"); + sb.append(" daysWithoutFlake: ").append(toIndentedString(daysWithoutFlake)).append("\n"); + sb.append(" failureRate: ").append(toIndentedString(failureRate)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" totalRuns: ").append(toIndentedString(totalRuns)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FlakyTestHistoryPolicyMetaConfig.java b/src/main/java/com/datadog/api/client/v2/model/FlakyTestHistoryPolicyMetaConfig.java new file mode 100644 index 00000000000..d6c328215d2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FlakyTestHistoryPolicyMetaConfig.java @@ -0,0 +1,418 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Configuration parameters of the policy that triggered this status change. */ +@JsonPropertyOrder({ + FlakyTestHistoryPolicyMetaConfig.JSON_PROPERTY_BRANCHES, + FlakyTestHistoryPolicyMetaConfig.JSON_PROPERTY_DAYS_ACTIVE, + FlakyTestHistoryPolicyMetaConfig.JSON_PROPERTY_FAILURE_RATE, + FlakyTestHistoryPolicyMetaConfig.JSON_PROPERTY_FORGET_BRANCHES, + FlakyTestHistoryPolicyMetaConfig.JSON_PROPERTY_REQUIRED_RUNS, + FlakyTestHistoryPolicyMetaConfig.JSON_PROPERTY_STATE, + FlakyTestHistoryPolicyMetaConfig.JSON_PROPERTY_TEST_SERVICES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FlakyTestHistoryPolicyMetaConfig { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BRANCHES = "branches"; + private JsonNullable> branches = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_DAYS_ACTIVE = "days_active"; + private JsonNullable daysActive = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_FAILURE_RATE = "failure_rate"; + private JsonNullable failureRate = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_FORGET_BRANCHES = "forget_branches"; + private JsonNullable> forgetBranches = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_REQUIRED_RUNS = "required_runs"; + private JsonNullable requiredRuns = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_STATE = "state"; + private JsonNullable state = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_TEST_SERVICES = "test_services"; + private JsonNullable> testServices = JsonNullable.>undefined(); + + public FlakyTestHistoryPolicyMetaConfig branches(List branches) { + this.branches = JsonNullable.>of(branches); + return this; + } + + public FlakyTestHistoryPolicyMetaConfig addBranchesItem(String branchesItem) { + if (this.branches == null || !this.branches.isPresent()) { + this.branches = JsonNullable.>of(new ArrayList<>()); + } + try { + this.branches.get().add(branchesItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * The branches considered by the policy. + * + * @return branches + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getBranches() { + return branches.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_BRANCHES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getBranches_JsonNullable() { + return branches; + } + + @JsonProperty(JSON_PROPERTY_BRANCHES) + public void setBranches_JsonNullable(JsonNullable> branches) { + this.branches = branches; + } + + public void setBranches(List branches) { + this.branches = JsonNullable.>of(branches); + } + + public FlakyTestHistoryPolicyMetaConfig daysActive(Integer daysActive) { + this.daysActive = JsonNullable.of(daysActive); + return this; + } + + /** + * The number of days a test must have been active for the policy to trigger. maximum: 2147483647 + * + * @return daysActive + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Integer getDaysActive() { + return daysActive.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DAYS_ACTIVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDaysActive_JsonNullable() { + return daysActive; + } + + @JsonProperty(JSON_PROPERTY_DAYS_ACTIVE) + public void setDaysActive_JsonNullable(JsonNullable daysActive) { + this.daysActive = daysActive; + } + + public void setDaysActive(Integer daysActive) { + this.daysActive = JsonNullable.of(daysActive); + } + + public FlakyTestHistoryPolicyMetaConfig failureRate(Double failureRate) { + this.failureRate = JsonNullable.of(failureRate); + return this; + } + + /** + * The failure rate threshold for the policy to trigger. minimum: 0 maximum: 1 + * + * @return failureRate + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Double getFailureRate() { + return failureRate.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_FAILURE_RATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getFailureRate_JsonNullable() { + return failureRate; + } + + @JsonProperty(JSON_PROPERTY_FAILURE_RATE) + public void setFailureRate_JsonNullable(JsonNullable failureRate) { + this.failureRate = failureRate; + } + + public void setFailureRate(Double failureRate) { + this.failureRate = JsonNullable.of(failureRate); + } + + public FlakyTestHistoryPolicyMetaConfig forgetBranches(List forgetBranches) { + this.forgetBranches = JsonNullable.>of(forgetBranches); + return this; + } + + public FlakyTestHistoryPolicyMetaConfig addForgetBranchesItem(String forgetBranchesItem) { + if (this.forgetBranches == null || !this.forgetBranches.isPresent()) { + this.forgetBranches = JsonNullable.>of(new ArrayList<>()); + } + try { + this.forgetBranches.get().add(forgetBranchesItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Branches excluded from the policy evaluation. + * + * @return forgetBranches + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getForgetBranches() { + return forgetBranches.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_FORGET_BRANCHES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getForgetBranches_JsonNullable() { + return forgetBranches; + } + + @JsonProperty(JSON_PROPERTY_FORGET_BRANCHES) + public void setForgetBranches_JsonNullable(JsonNullable> forgetBranches) { + this.forgetBranches = forgetBranches; + } + + public void setForgetBranches(List forgetBranches) { + this.forgetBranches = JsonNullable.>of(forgetBranches); + } + + public FlakyTestHistoryPolicyMetaConfig requiredRuns(Integer requiredRuns) { + this.requiredRuns = JsonNullable.of(requiredRuns); + return this; + } + + /** + * The minimum number of test runs required for the policy to trigger. maximum: 2147483647 + * + * @return requiredRuns + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Integer getRequiredRuns() { + return requiredRuns.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_REQUIRED_RUNS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getRequiredRuns_JsonNullable() { + return requiredRuns; + } + + @JsonProperty(JSON_PROPERTY_REQUIRED_RUNS) + public void setRequiredRuns_JsonNullable(JsonNullable requiredRuns) { + this.requiredRuns = requiredRuns; + } + + public void setRequiredRuns(Integer requiredRuns) { + this.requiredRuns = JsonNullable.of(requiredRuns); + } + + public FlakyTestHistoryPolicyMetaConfig state(String state) { + this.state = JsonNullable.of(state); + return this; + } + + /** + * The target state the policy transitions the test from. + * + * @return state + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getState() { + return state.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getState_JsonNullable() { + return state; + } + + @JsonProperty(JSON_PROPERTY_STATE) + public void setState_JsonNullable(JsonNullable state) { + this.state = state; + } + + public void setState(String state) { + this.state = JsonNullable.of(state); + } + + public FlakyTestHistoryPolicyMetaConfig testServices(List testServices) { + this.testServices = JsonNullable.>of(testServices); + return this; + } + + public FlakyTestHistoryPolicyMetaConfig addTestServicesItem(String testServicesItem) { + if (this.testServices == null || !this.testServices.isPresent()) { + this.testServices = JsonNullable.>of(new ArrayList<>()); + } + try { + this.testServices.get().add(testServicesItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Test services excluded from the policy evaluation. + * + * @return testServices + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getTestServices() { + return testServices.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TEST_SERVICES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getTestServices_JsonNullable() { + return testServices; + } + + @JsonProperty(JSON_PROPERTY_TEST_SERVICES) + public void setTestServices_JsonNullable(JsonNullable> testServices) { + this.testServices = testServices; + } + + public void setTestServices(List testServices) { + this.testServices = JsonNullable.>of(testServices); + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FlakyTestHistoryPolicyMetaConfig + */ + @JsonAnySetter + public FlakyTestHistoryPolicyMetaConfig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FlakyTestHistoryPolicyMetaConfig object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FlakyTestHistoryPolicyMetaConfig flakyTestHistoryPolicyMetaConfig = + (FlakyTestHistoryPolicyMetaConfig) o; + return Objects.equals(this.branches, flakyTestHistoryPolicyMetaConfig.branches) + && Objects.equals(this.daysActive, flakyTestHistoryPolicyMetaConfig.daysActive) + && Objects.equals(this.failureRate, flakyTestHistoryPolicyMetaConfig.failureRate) + && Objects.equals(this.forgetBranches, flakyTestHistoryPolicyMetaConfig.forgetBranches) + && Objects.equals(this.requiredRuns, flakyTestHistoryPolicyMetaConfig.requiredRuns) + && Objects.equals(this.state, flakyTestHistoryPolicyMetaConfig.state) + && Objects.equals(this.testServices, flakyTestHistoryPolicyMetaConfig.testServices) + && Objects.equals( + this.additionalProperties, flakyTestHistoryPolicyMetaConfig.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + branches, + daysActive, + failureRate, + forgetBranches, + requiredRuns, + state, + testServices, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FlakyTestHistoryPolicyMetaConfig {\n"); + sb.append(" branches: ").append(toIndentedString(branches)).append("\n"); + sb.append(" daysActive: ").append(toIndentedString(daysActive)).append("\n"); + sb.append(" failureRate: ").append(toIndentedString(failureRate)).append("\n"); + sb.append(" forgetBranches: ").append(toIndentedString(forgetBranches)).append("\n"); + sb.append(" requiredRuns: ").append(toIndentedString(requiredRuns)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" testServices: ").append(toIndentedString(testServices)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FlakyTestsSearchFilter.java b/src/main/java/com/datadog/api/client/v2/model/FlakyTestsSearchFilter.java index e69ed3f25a0..e4428772663 100644 --- a/src/main/java/com/datadog/api/client/v2/model/FlakyTestsSearchFilter.java +++ b/src/main/java/com/datadog/api/client/v2/model/FlakyTestsSearchFilter.java @@ -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; @@ -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)) diff --git a/src/main/java/com/datadog/api/client/v2/model/FlakyTestsSearchRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FlakyTestsSearchRequestAttributes.java index b8c4e04d22e..eb6799104de 100644 --- a/src/main/java/com/datadog/api/client/v2/model/FlakyTestsSearchRequestAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/FlakyTestsSearchRequestAttributes.java @@ -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 }) @@ -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; @@ -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 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 FlakyTestsSearchRequestAttributes page(FlakyTestsSearchPageOptions page) { this.page = page; this.unparsed |= page.unparsed; @@ -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( @@ -199,7 +171,7 @@ 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 @@ -207,7 +179,6 @@ 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: ") diff --git a/src/test/resources/com/datadog/api/client/v2/api/test_optimization.feature b/src/test/resources/com/datadog/api/client/v2/api/test_optimization.feature index 427db05baf4..27f337f9299 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/test_optimization.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/test_optimization.feature @@ -85,7 +85,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 @@ -101,7 +101,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 @@ -117,19 +117,21 @@ 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" And the response "data[0].attributes.history[0]" has field "status" And the response "data[0].attributes.history[0]" has field "commit_sha" And the response "data[0].attributes.history[0]" has field "timestamp" + And the response "data[0].attributes.history[0]" has field "policy_id" + And the response "data[0].attributes.history[0]" has field "policy_meta" @generated @skip @team:DataDog/ci-app-backend @with-pagination 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