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
17 changes: 17 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38276,6 +38276,17 @@ components:
items:
$ref: "#/components/schemas/FlakyTestHistory"
type: array
impact_level:
$ref: "#/components/schemas/FlakyTestImpactLevel"
nullable: true
impact_score:
description: A score from 0 to 1 indicating the impact of this flaky test, based on factors such as how often it fails and how many pipelines it affects.
example: 0.78
format: double
maximum: 1
minimum: 0
nullable: true
type: number
last_flaked_branch:
description: The branch name where the test exhibited flakiness for the last time.
example: main
Expand Down Expand Up @@ -38484,6 +38495,12 @@ components:
nullable: true
type: array
type: object
FlakyTestImpactLevel:
description: The impact level of the flaky test, derived from its impact score.
enum: [low, medium, high]
example: medium
type: string
x-enum-varnames: [LOW, MEDIUM, HIGH]
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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
FlakyTestAttributes.JSON_PROPERTY_FLAKY_CATEGORY,
FlakyTestAttributes.JSON_PROPERTY_FLAKY_STATE,
FlakyTestAttributes.JSON_PROPERTY_HISTORY,
FlakyTestAttributes.JSON_PROPERTY_IMPACT_LEVEL,
FlakyTestAttributes.JSON_PROPERTY_IMPACT_SCORE,
FlakyTestAttributes.JSON_PROPERTY_LAST_FLAKED_BRANCH,
FlakyTestAttributes.JSON_PROPERTY_LAST_FLAKED_SHA,
FlakyTestAttributes.JSON_PROPERTY_LAST_FLAKED_TS,
Expand Down Expand Up @@ -72,6 +74,12 @@ public class FlakyTestAttributes {
public static final String JSON_PROPERTY_HISTORY = "history";
private List<FlakyTestHistory> history = null;

public static final String JSON_PROPERTY_IMPACT_LEVEL = "impact_level";
private FlakyTestImpactLevel impactLevel;

public static final String JSON_PROPERTY_IMPACT_SCORE = "impact_score";
private JsonNullable<Double> impactScore = JsonNullable.<Double>undefined();

public static final String JSON_PROPERTY_LAST_FLAKED_BRANCH = "last_flaked_branch";
private String lastFlakedBranch;

Expand Down Expand Up @@ -348,6 +356,63 @@ public void setHistory(List<FlakyTestHistory> history) {
}
}

public FlakyTestAttributes impactLevel(FlakyTestImpactLevel impactLevel) {
this.impactLevel = impactLevel;
this.unparsed |= !impactLevel.isValid();
return this;
}

/**
* The impact level of the flaky test, derived from its impact score.
*
* @return impactLevel
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_IMPACT_LEVEL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public FlakyTestImpactLevel getImpactLevel() {
return impactLevel;
}

public void setImpactLevel(FlakyTestImpactLevel impactLevel) {
if (!impactLevel.isValid()) {
this.unparsed = true;
}
this.impactLevel = impactLevel;
}

public FlakyTestAttributes impactScore(Double impactScore) {
this.impactScore = JsonNullable.<Double>of(impactScore);
return this;
}

/**
* A score from 0 to 1 indicating the impact of this flaky test, based on factors such as how
* often it fails and how many pipelines it affects. minimum: 0 maximum: 1
*
* @return impactScore
*/
@jakarta.annotation.Nullable
@JsonIgnore
public Double getImpactScore() {
return impactScore.orElse(null);
}

@JsonProperty(JSON_PROPERTY_IMPACT_SCORE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Double> getImpactScore_JsonNullable() {
return impactScore;
}

@JsonProperty(JSON_PROPERTY_IMPACT_SCORE)
public void setImpactScore_JsonNullable(JsonNullable<Double> impactScore) {
this.impactScore = impactScore;
}

public void setImpactScore(Double impactScore) {
this.impactScore = JsonNullable.<Double>of(impactScore);
}

public FlakyTestAttributes lastFlakedBranch(String lastFlakedBranch) {
this.lastFlakedBranch = lastFlakedBranch;
return this;
Expand Down Expand Up @@ -667,6 +732,8 @@ public boolean equals(Object o) {
&& Objects.equals(this.flakyCategory, flakyTestAttributes.flakyCategory)
&& Objects.equals(this.flakyState, flakyTestAttributes.flakyState)
&& Objects.equals(this.history, flakyTestAttributes.history)
&& Objects.equals(this.impactLevel, flakyTestAttributes.impactLevel)
&& Objects.equals(this.impactScore, flakyTestAttributes.impactScore)
&& Objects.equals(this.lastFlakedBranch, flakyTestAttributes.lastFlakedBranch)
&& Objects.equals(this.lastFlakedSha, flakyTestAttributes.lastFlakedSha)
&& Objects.equals(this.lastFlakedTs, flakyTestAttributes.lastFlakedTs)
Expand All @@ -692,6 +759,8 @@ public int hashCode() {
flakyCategory,
flakyState,
history,
impactLevel,
impactScore,
lastFlakedBranch,
lastFlakedSha,
lastFlakedTs,
Expand All @@ -718,6 +787,8 @@ public String toString() {
sb.append(" flakyCategory: ").append(toIndentedString(flakyCategory)).append("\n");
sb.append(" flakyState: ").append(toIndentedString(flakyState)).append("\n");
sb.append(" history: ").append(toIndentedString(history)).append("\n");
sb.append(" impactLevel: ").append(toIndentedString(impactLevel)).append("\n");
sb.append(" impactScore: ").append(toIndentedString(impactScore)).append("\n");
sb.append(" lastFlakedBranch: ").append(toIndentedString(lastFlakedBranch)).append("\n");
sb.append(" lastFlakedSha: ").append(toIndentedString(lastFlakedSha)).append("\n");
sb.append(" lastFlakedTs: ").append(toIndentedString(lastFlakedTs)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* 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 impact level of the flaky test, derived from its impact score. */
@JsonSerialize(using = FlakyTestImpactLevel.FlakyTestImpactLevelSerializer.class)
public class FlakyTestImpactLevel extends ModelEnum<String> {

private static final Set<String> allowedValues =
new HashSet<String>(Arrays.asList("low", "medium", "high"));

public static final FlakyTestImpactLevel LOW = new FlakyTestImpactLevel("low");
public static final FlakyTestImpactLevel MEDIUM = new FlakyTestImpactLevel("medium");
public static final FlakyTestImpactLevel HIGH = new FlakyTestImpactLevel("high");

FlakyTestImpactLevel(String value) {
super(value, allowedValues);
}

public static class FlakyTestImpactLevelSerializer extends StdSerializer<FlakyTestImpactLevel> {
public FlakyTestImpactLevelSerializer(Class<FlakyTestImpactLevel> t) {
super(t);
}

public FlakyTestImpactLevelSerializer() {
this(null);
}

@Override
public void serialize(
FlakyTestImpactLevel value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonProcessingException {
jgen.writeObject(value.value);
}
}

@JsonCreator
public static FlakyTestImpactLevel fromValue(String value) {
return new FlakyTestImpactLevel(value);
}
}
Loading