Skip to content

Commit

Permalink
Improved error logs for missing 'using' configuration in metadata file (
Browse files Browse the repository at this point in the history
#2052)

Co-authored-by: Octavia Stancu <[email protected]>
  • Loading branch information
AvaStancu and Octavia Stancu authored Aug 16, 2022
1 parent 84e7949 commit f9c2bf1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Runner.Worker/ActionManifestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ private ActionExecutionData ConvertRuns(
};
}

throw new NotSupportedException(nameof(ConvertRuns));
throw new NotSupportedException("Missing 'using' value. 'using' requires 'composite', 'docker', 'node12' or 'node16'.");
}

private void ConvertInputs(
Expand Down
25 changes: 25 additions & 0 deletions src/Test/L0/Worker/ActionManifestManagerL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,31 @@ public void Load_ConditionalCompositeAction()
}
}

[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
public void Load_CompositeActionNoUsing()
{
try
{
//Arrange
Setup();

var actionManifest = new ActionManifestManager();
actionManifest.Initialize(_hc);
var action_path = Path.Combine(TestUtil.GetTestDataPath(), "composite_action_without_using_token.yml");

//Assert
var err = Assert.Throws<ArgumentException>(() => actionManifest.Load(_ec.Object, action_path));
Assert.Contains($"Fail to load {action_path}", err.Message);
_ec.Verify(x => x.AddIssue(It.Is<Issue>(s => s.Message.Contains("Missing 'using' value. 'using' requires 'composite', 'docker', 'node12' or 'node16'.")), It.IsAny<string>()), Times.Once);
}
finally
{
Teardown();
}
}

[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
Expand Down
9 changes: 9 additions & 0 deletions src/Test/TestData/composite_action_without_using_token.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: "composite action"
description: "test composite action without value for the 'using' token in 'runs'"

runs:
steps:
- id: mystep
shell: bash
run: |
echo "hello world"

0 comments on commit f9c2bf1

Please sign in to comment.