mirror of
https://github.com/ppy/osu
synced 2024-12-24 15:53:37 +00:00
Add attribute to retry flaky tests on normal CI runs
This commit is contained in:
parent
409224560f
commit
1777a6d24a
26
osu.Game/Tests/FlakyTestAttribute.cs
Normal file
26
osu.Game/Tests/FlakyTestAttribute.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
using System;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An attribute to mark any flaky tests.
|
||||||
|
/// Will add a retry count unless environment variable `FAIL_FLAKY_TESTS` is set to `1`.
|
||||||
|
/// </summary>
|
||||||
|
public class FlakyTestAttribute : RetryAttribute
|
||||||
|
{
|
||||||
|
public FlakyTestAttribute()
|
||||||
|
: this(10)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public FlakyTestAttribute(int tryCount)
|
||||||
|
: base(Environment.GetEnvironmentVariable("FAIL_FLAKY_TESTS") == "1" ? 0 : tryCount)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user