Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATA: RunUntilFailureTask #142

Closed

Conversation

mabroukmahdhi
Copy link
Contributor

closes #141

@mabroukmahdhi mabroukmahdhi self-assigned this Jan 24, 2025
@github-actions github-actions bot added the DATA For creating data models and migrations label Jan 24, 2025
Copy link
Collaborator

@cjdutoit cjdutoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all items that is not related to this PR. Only expecting RunDotNetTestsUntilFailureTasks


namespace ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks
{
public class RunUntilFailureTask : GithubTask
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest a name change so it is clear that it is referring to dotnet test runner

Suggested change
public class RunUntilFailureTask : GithubTask
public class RunDotNetTestUntilFailureTask : GithubTask

Comment on lines +13 to +19
[YamlMember(Order = 1, Alias = "shell", DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)]
public override string Shell => "bash";

[YamlMember(Order = 2, Alias = "run", DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)]
public override string Run => "for i in {1..1000};" +
@" do echo ""Run #$i""; dotnet test --no-build " +
"--verbosity normal --filter 'FullyQualifiedName!~Integrations' || exit 1; done";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[YamlMember(Order = 1, Alias = "shell", DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)]
public override string Shell => "bash";
[YamlMember(Order = 2, Alias = "run", DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)]
public override string Run => "for i in {1..1000};" +
@" do echo ""Run #$i""; dotnet test --no-build " +
"--verbosity normal --filter 'FullyQualifiedName!~Integrations' || exit 1; done";
/// <summary>
/// Gets or sets the name of the task.
/// </summary>
public override string Name { get; set; } = "Run .NET Tests Until Failure";
/// <summary>
/// Gets the shell type used to execute the task.
/// The default value is: "bash".
/// </summary>
public override string Shell => "bash";
/// <summary>
/// Gets the command to execute for the task.
/// The command runs a loop that repeatedly executes .NET tests up to 1,000 times
/// or until a failure occurs. If a test fails, the loop exits with an error code.
/// The default value is:
/// "for i in {1..1000}; do echo \"Run #$i\"; dotnet test --no-build --verbosity normal --filter 'FullyQualifiedName!~Integrations' || exit 1; done".
/// </summary>
public override string Run =>
"for i in {1..1000};" +
@" do echo ""Run #$i""; dotnet test --no-build " +
"--verbosity normal --filter 'FullyQualifiedName!~Integrations' || exit 1; done";

Copy link
Collaborator

@cjdutoit cjdutoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth adding a constructor with some default arguments, so you could change the iteration if needed.

I am in two minds about this component. I feel this one might be better as a job component or a job component that uses this task and the reason for this is that this could be a very long running task which will have a time impact and potentially a resource cost impact. I am thinking create a job where you can conditionally trigger this via a tag/label on the PR similar to the TagJob that checks for the presence of the RELEASES as a pre condition for tag and release.

You can then conditionally trigger this via the label only when you need it i.e. when testing flaky or intermittent issues, stress testing, or regression testing but not subjecting devs to time delays for normal routine testing.

Thoughts @hassanhabib / @mabroukmahdhi ?

@mabroukmahdhi
Copy link
Contributor Author

I will re-implement this differently and create a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DATA For creating data models and migrations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DATA: RunUntilFailureTask
2 participants