Skip to content

Commit 243efd4

Browse files
committed
fix(tests): make directory configuration tests environment-neutral
The directory configuration tests were hardcoded to expect dev container paths like '/workspaces/flowtime-vnext/data' which caused CI failures when running in GitHub Actions environment with different paths. Changes: - Updated CLI tests to use DirectoryProvider.GetDefaultDataDirectory() - Updated API tests to use DirectoryProvider.GetDefaultDataDirectory() - Updated Core tests to verify solution root discovery works correctly - Added proper using statements for DirectoryProvider Tests now dynamically discover the solution root and verify correct data directory resolution regardless of environment (dev container, CI, local development, etc.).
1 parent cf3ebdb commit 243efd4

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

tests/FlowTime.Api.Tests/ConfigurationTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using FlowTime.Core.Configuration;
12
using Microsoft.Extensions.Configuration;
23
using Xunit;
34

@@ -67,7 +68,7 @@ public void GetArtifactsDirectory_NoConfiguration_ReturnsDefaultData()
6768
{
6869
// Arrange
6970
var configuration = new ConfigurationBuilder().Build();
70-
var expectedPath = "/workspaces/flowtime-vnext/data";
71+
var expectedPath = DirectoryProvider.GetDefaultDataDirectory();
7172

7273
// Ensure no environment variable or configuration
7374
Environment.SetEnvironmentVariable("FLOWTIME_DATA_DIR", null);

tests/FlowTime.Cli.Tests/OutputDirectoryConfigurationTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using FlowTime.Cli.Configuration;
2+
using FlowTime.Core.Configuration;
23
using System;
34
using System.IO;
45
using Xunit;
@@ -50,7 +51,7 @@ public void GetDefaultOutputDirectory_NoEnvironmentVariable_ReturnsDefaultData()
5051
{
5152
// Arrange
5253
Environment.SetEnvironmentVariable("FLOWTIME_DATA_DIR", null);
53-
var expectedPath = "/workspaces/flowtime-vnext/data";
54+
var expectedPath = DirectoryProvider.GetDefaultDataDirectory();
5455

5556
// Act
5657
var result = OutputDirectoryProvider.GetDefaultOutputDirectory();
@@ -64,7 +65,7 @@ public void GetDefaultOutputDirectory_EmptyEnvironmentVariable_FallsBackToDefaul
6465
{
6566
// Arrange
6667
Environment.SetEnvironmentVariable("FLOWTIME_DATA_DIR", string.Empty);
67-
var expectedPath = "/workspaces/flowtime-vnext/data";
68+
var expectedPath = DirectoryProvider.GetDefaultDataDirectory();
6869

6970
// Act
7071
var result = OutputDirectoryProvider.GetDefaultOutputDirectory();
@@ -78,7 +79,7 @@ public void GetDefaultOutputDirectory_WhitespaceEnvironmentVariable_FallsBackToD
7879
{
7980
// Arrange
8081
Environment.SetEnvironmentVariable("FLOWTIME_DATA_DIR", " ");
81-
var expectedPath = "/workspaces/flowtime-vnext/data";
82+
var expectedPath = DirectoryProvider.GetDefaultDataDirectory();
8283

8384
// Act
8485
var result = OutputDirectoryProvider.GetDefaultOutputDirectory();

tests/FlowTime.Tests/Configuration/DirectoryProviderTests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ public void GetDefaultDataDirectory_FindsSolutionRoot()
1212

1313
// Assert
1414
// Should find the solution root and append /data
15-
Assert.Contains("flowtime-vnext", dataDir);
1615
Assert.EndsWith("data", dataDir);
1716

1817
// Should not be relative to current directory when solution root is found
1918
Assert.DoesNotContain("FlowTime.Tests", dataDir);
19+
20+
// Should contain the directory where FlowTime.sln exists
21+
var solutionRoot = DirectoryProvider.FindSolutionRoot();
22+
Assert.NotNull(solutionRoot);
23+
Assert.Equal(Path.Combine(solutionRoot, "data"), dataDir);
2024
}
2125

2226
[Fact]

0 commit comments

Comments
 (0)