For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ko/api/latest/test-optimization/update-flaky-tests-management-policies.md. A documentation index is available at /llms.txt.
Language
Datadog site

불안정한 테스트 관리 정책 업데이트

PATCHhttps://api.datadoghq.com/api/v2/ci/test-optimization/settings/policieshttps://api.us3.datadoghq.com/api/v2/ci/test-optimization/settings/policieshttps://api.us5.datadoghq.com/api/v2/ci/test-optimization/settings/policieshttps://api.datadoghq.eu/api/v2/ci/test-optimization/settings/policieshttps://api.ap1.datadoghq.com/api/v2/ci/test-optimization/settings/policieshttps://api.ap2.datadoghq.com/api/v2/ci/test-optimization/settings/policieshttps://api.uk1.datadoghq.com/api/v2/ci/test-optimization/settings/policieshttps://api.ddog-gov.com/api/v2/ci/test-optimization/settings/policieshttps://api.us2.ddog-gov.com/api/v2/ci/test-optimization/settings/policies

개요

지정된 리포지토리에 대한 Flaky Tests Management 리포지토리 수준 정책을 부분적으로 업데이트합니다. 제공된 정책 블록만 업데이트되며 생략된 블록은 변경되지 않습니다.

This endpoint requires the test_optimization_settings_write permission.

OAuth apps require the test_optimization_settings_write authorization scope to access this endpoint.

요청

Body Data (required)

항목
유형
설명
data [required]
object

불안정한 테스트 관리 정책 업데이트를 위한 요청 객체입니다.

응답

OK

Response object containing Flaky Tests Management policies for a repository.

항목
유형
설명
data
object

Data object for Flaky Tests Management policies response.

코드 예시

불안정한 테스트 관리 정책 업데이트
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/test-optimization/settings/policies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "attempt_to_fix": {
        "retries": 3
      },
      "disabled": {
        "enabled": false
      },
      "quarantined": {
        "auto_quarantine_rule": {
          "enabled": true,
          "window_seconds": 3600
        },
        "branch_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "excluded_branches": [],
          "excluded_test_services": []
        },
        "enabled": true,
        "failure_rate_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "min_runs": 10,
          "threshold": 0.5
        }
      },
      "repository_id": "github.com/example-org/example-repo"
    },
    "type": "test_optimization_update_flaky_tests_management_policies_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/test-optimization/settings/policies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "attempt_to_fix": {
        "retries": 3
      },
      "disabled": {
        "enabled": false
      },
      "quarantined": {
        "auto_quarantine_rule": {
          "enabled": true,
          "window_seconds": 3600
        },
        "branch_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "excluded_branches": [],
          "excluded_test_services": []
        },
        "enabled": true,
        "failure_rate_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "min_runs": 10,
          "threshold": 0.5
        }
      },
      "repository_id": "github.com/example-org/example-repo"
    },
    "type": "test_optimization_update_flaky_tests_management_policies_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/test-optimization/settings/policies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "attempt_to_fix": {
        "retries": 3
      },
      "disabled": {
        "enabled": false
      },
      "quarantined": {
        "auto_quarantine_rule": {
          "enabled": true,
          "window_seconds": 3600
        },
        "branch_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "excluded_branches": [],
          "excluded_test_services": []
        },
        "enabled": true,
        "failure_rate_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "min_runs": 10,
          "threshold": 0.5
        }
      },
      "repository_id": "github.com/example-org/example-repo"
    },
    "type": "test_optimization_update_flaky_tests_management_policies_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/test-optimization/settings/policies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "attempt_to_fix": {
        "retries": 3
      },
      "disabled": {
        "enabled": false
      },
      "quarantined": {
        "auto_quarantine_rule": {
          "enabled": true,
          "window_seconds": 3600
        },
        "branch_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "excluded_branches": [],
          "excluded_test_services": []
        },
        "enabled": true,
        "failure_rate_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "min_runs": 10,
          "threshold": 0.5
        }
      },
      "repository_id": "github.com/example-org/example-repo"
    },
    "type": "test_optimization_update_flaky_tests_management_policies_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/test-optimization/settings/policies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "attempt_to_fix": {
        "retries": 3
      },
      "disabled": {
        "enabled": false
      },
      "quarantined": {
        "auto_quarantine_rule": {
          "enabled": true,
          "window_seconds": 3600
        },
        "branch_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "excluded_branches": [],
          "excluded_test_services": []
        },
        "enabled": true,
        "failure_rate_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "min_runs": 10,
          "threshold": 0.5
        }
      },
      "repository_id": "github.com/example-org/example-repo"
    },
    "type": "test_optimization_update_flaky_tests_management_policies_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/test-optimization/settings/policies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "attempt_to_fix": {
        "retries": 3
      },
      "disabled": {
        "enabled": false
      },
      "quarantined": {
        "auto_quarantine_rule": {
          "enabled": true,
          "window_seconds": 3600
        },
        "branch_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "excluded_branches": [],
          "excluded_test_services": []
        },
        "enabled": true,
        "failure_rate_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "min_runs": 10,
          "threshold": 0.5
        }
      },
      "repository_id": "github.com/example-org/example-repo"
    },
    "type": "test_optimization_update_flaky_tests_management_policies_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/test-optimization/settings/policies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "attempt_to_fix": {
        "retries": 3
      },
      "disabled": {
        "enabled": false
      },
      "quarantined": {
        "auto_quarantine_rule": {
          "enabled": true,
          "window_seconds": 3600
        },
        "branch_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "excluded_branches": [],
          "excluded_test_services": []
        },
        "enabled": true,
        "failure_rate_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "min_runs": 10,
          "threshold": 0.5
        }
      },
      "repository_id": "github.com/example-org/example-repo"
    },
    "type": "test_optimization_update_flaky_tests_management_policies_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/test-optimization/settings/policies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "attempt_to_fix": {
        "retries": 3
      },
      "disabled": {
        "enabled": false
      },
      "quarantined": {
        "auto_quarantine_rule": {
          "enabled": true,
          "window_seconds": 3600
        },
        "branch_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "excluded_branches": [],
          "excluded_test_services": []
        },
        "enabled": true,
        "failure_rate_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "min_runs": 10,
          "threshold": 0.5
        }
      },
      "repository_id": "github.com/example-org/example-repo"
    },
    "type": "test_optimization_update_flaky_tests_management_policies_request"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/test-optimization/settings/policies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "attempt_to_fix": {
        "retries": 3
      },
      "disabled": {
        "enabled": false
      },
      "quarantined": {
        "auto_quarantine_rule": {
          "enabled": true,
          "window_seconds": 3600
        },
        "branch_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "excluded_branches": [],
          "excluded_test_services": []
        },
        "enabled": true,
        "failure_rate_rule": {
          "branches": [
            "main"
          ],
          "enabled": true,
          "min_runs": 10,
          "threshold": 0.5
        }
      },
      "repository_id": "github.com/example-org/example-repo"
    },
    "type": "test_optimization_update_flaky_tests_management_policies_request"
  }
}
EOF