Skip to content
Merged
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
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
dotnet-quality: preview
dotnet-version: 10.0.103

- name: Restore dependencies
run: dotnet restore
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ docker-compose.override.yml
publish/
out/
artifacts/
*.pubxml
*.pubxml.user

##############################
# Coverage tools
Expand Down
87 changes: 87 additions & 0 deletions CodeGenesis.Engine.Tests/Config/PipelineConfigLoaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,93 @@ public void LoadFromFile_ParallelMissingBranches_ThrowsInvalidOperation()
}
}

[Fact]
public void LoadFromFile_UsePipelineStep_ParsesCorrectly()
{
var yaml = """
pipeline:
name: Composition Test
steps:
- name: Run child
use_pipeline: ./child.yml
inputs:
source: "some value"
output_key: child_result
""";

var path = Path.Combine(Path.GetTempPath(), $"test-{Guid.NewGuid()}.yaml");
File.WriteAllText(path, yaml);
try
{
var config = PipelineConfigLoader.LoadFromFile(path);

config.Steps.Should().HaveCount(1);
config.Steps[0].IsUsePipeline.Should().BeTrue();
config.Steps[0].IsSimpleStep.Should().BeFalse();
config.Steps[0].Name.Should().Be("Run child");
config.Steps[0].UsePipeline.Should().Be("./child.yml");
config.Steps[0].Inputs.Should().ContainKey("source");
config.Steps[0].Inputs!["source"].Should().Be("some value");
config.Steps[0].OutputKey.Should().Be("child_result");
}
finally
{
File.Delete(path);
}
}

[Fact]
public void LoadFromFile_UsePipelineMissingName_ThrowsInvalidOperation()
{
var yaml = """
pipeline:
name: Bad
steps:
- use_pipeline: ./child.yml
""";

var path = Path.Combine(Path.GetTempPath(), $"test-{Guid.NewGuid()}.yaml");
File.WriteAllText(path, yaml);
try
{
var act = () => PipelineConfigLoader.LoadFromFile(path);

act.Should().Throw<InvalidOperationException>()
.WithMessage("*missing a 'name'*");
}
finally
{
File.Delete(path);
}
}

[Fact]
public void LoadFromFile_UsePipelineWithOptional_ParsesCorrectly()
{
var yaml = """
pipeline:
name: Optional Test
steps:
- name: Optional child
use_pipeline: ./child.yml
optional: true
""";

var path = Path.Combine(Path.GetTempPath(), $"test-{Guid.NewGuid()}.yaml");
File.WriteAllText(path, yaml);
try
{
var config = PipelineConfigLoader.LoadFromFile(path);

config.Steps[0].IsUsePipeline.Should().BeTrue();
config.Steps[0].Optional.Should().BeTrue();
}
finally
{
File.Delete(path);
}
}

[Fact]
public void LoadFromFile_WithInputsAndOutputs_ParsesCorrectly()
{
Expand Down
35 changes: 35 additions & 0 deletions CodeGenesis.Engine.Tests/Config/StepEntryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,41 @@ public void IsApproval_WithConfig_ReturnsTrue()
entry.IsSimpleStep.Should().BeFalse();
}

[Fact]
public void IsUsePipeline_WithUsePipeline_ReturnsTrue()
{
var entry = new StepEntry
{
Name = "sub",
UsePipeline = "./child.yml"
};

entry.IsUsePipeline.Should().BeTrue();
entry.IsSimpleStep.Should().BeFalse();
entry.IsForeach.Should().BeFalse();
entry.IsParallel.Should().BeFalse();
}

[Fact]
public void IsUsePipeline_WithoutUsePipeline_ReturnsFalse()
{
var entry = new StepEntry { Name = "step1", Prompt = "do something" };

entry.IsUsePipeline.Should().BeFalse();
}

[Fact]
public void IsSimpleStep_WithUsePipeline_ReturnsFalse()
{
var entry = new StepEntry
{
Name = "sub",
UsePipeline = "./child.yml"
};

entry.IsSimpleStep.Should().BeFalse();
}

[Fact]
public void IsSimpleStep_NullNameNoComposite_ReturnsFalse()
{
Expand Down
Loading