Skip to content

Commit

Permalink
Merge branch 'main' into tty-highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
aknysh authored Jan 9, 2025
2 parents fa5a975 + 059eccb commit f54263f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
28 changes: 26 additions & 2 deletions tests/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,29 @@ func (pm *PathManager) Apply() error {
return os.Setenv("PATH", pm.GetPath())
}

// loadTestSuites loads and merges all .yaml files from the test-cases directory
func loadTestSuites(testCasesDir string) (*TestSuite, error) {
var mergedSuite TestSuite

entries, err := os.ReadDir(testCasesDir)
if err != nil {
return nil, fmt.Errorf("failed to read test-cases directory: %v", err)
}

for _, entry := range entries {
if !entry.IsDir() && strings.HasSuffix(entry.Name(), ".yaml") {
filePath := filepath.Join(testCasesDir, entry.Name())
suite, err := loadTestSuite(filePath)
if err != nil {
return nil, fmt.Errorf("failed to load %s: %v", filePath, err)
}
mergedSuite.Tests = append(mergedSuite.Tests, suite.Tests...)
}
}

return &mergedSuite, nil
}

func TestCLICommands(t *testing.T) {
// Capture the starting working directory
startingDir, err := os.Getwd()
Expand All @@ -108,9 +131,10 @@ func TestCLICommands(t *testing.T) {
}
fmt.Printf("Updated PATH: %s\n", pathManager.GetPath())

testSuite, err := loadTestSuite("test_cases.yaml")
// Update the test suite loading
testSuite, err := loadTestSuites("test-cases")
if err != nil {
t.Fatalf("Failed to load test suite: %v", err)
t.Fatalf("Failed to load test suites: %v", err)
}

for _, tc := range testSuite.Tests {
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion tests/test_cases.yaml → tests/test-cases/complete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ tests:
- name: atmos circuit-breaker
enabled: true
description: "Ensure atmos breaks the infinite loop when shell depth exceeds maximum (10)."
workdir: "../tests/fixtures/scenarios/complete/"
workdir: "fixtures/scenarios/complete/"
command: "atmos"
args:
- "loop"
Expand Down

0 comments on commit f54263f

Please sign in to comment.