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

feat: Test Cases as a Directory #922

Merged
merged 30 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7dae7f9
Add support for locking components with metadata.locked
milldr Jan 3, 2025
08bc176
Update function call to include an additional parameter
milldr Jan 3, 2025
bdc95a3
Adding example for testing
milldr Jan 3, 2025
2938bdc
Add test cases for atmos terraform deploy commands
milldr Jan 3, 2025
6278761
Remove unnecessary stdout and stderr checks
milldr Jan 3, 2025
01d5db9
move examples/tests to tests/fixtures/complete
milldr Jan 6, 2025
4baa894
replace all s|examples/tests|tests/fixtures/scenarios/complete|g
milldr Jan 6, 2025
88637c6
replace all s|examples/tests|tests/fixtures/scenarios/complete|g
milldr Jan 6, 2025
6ecb5fe
use common component directory for test fixtures
milldr Jan 6, 2025
1361f75
debugging test example rename
milldr Jan 6, 2025
a3de909
Merge branch 'main' into chore/DEV-2906_test-fixtures
milldr Jan 6, 2025
b662a49
Update demo-folder paths and fix working-directory in test.yml
milldr Jan 6, 2025
9e09744
removed shared components
milldr Jan 6, 2025
6451aee
Remove cache.yaml from demo-stacks directory
milldr Jan 6, 2025
a79ba8d
merged main
milldr Jan 6, 2025
2519157
Merge branch 'chore/DEV-2906_test-fixtures' into feat/DEV-2849_metada…
milldr Jan 6, 2025
c4c94d1
create test fixture for metadata
milldr Jan 6, 2025
4c9087f
Merge branch 'main' into feat/DEV-2849_metadata-locked
milldr Jan 6, 2025
1355349
Update test case to include expected exit code 1
milldr Jan 6, 2025
682cdfd
Add atmos schema with locked flag in atmos manifest
milldr Jan 6, 2025
9a994be
support separate test case files, added metadata tests
milldr Jan 6, 2025
eb3ab97
support separate test case files, added metadata tests
milldr Jan 6, 2025
4965f7c
Remove 'secrets' option from locked component commands
milldr Jan 7, 2025
880240e
Merge branch 'main' into feat/DEV-2849_metadata-locked
aknysh Jan 7, 2025
1c669f1
Add 'locked' property in atmos-manifest schema
milldr Jan 7, 2025
d85e9cd
Add ignore rule for cache text files
milldr Jan 7, 2025
fe3046c
Reset everything not required for test cases dir
milldr Jan 9, 2025
eb84077
Merge branch 'main' into feat/test-cases-as-dir
milldr Jan 9, 2025
718d02b
Reset everything not required for test cases dir
milldr Jan 9, 2025
f07fa02
Reset everything not required for test cases dir
milldr Jan 9, 2025
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
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
Loading