Move unit tests from tests/unit/ to internal/ following Go conventions: - tests/unit/config/* -> internal/config/* (constants, mode_paths, paths, validation) - tests/unit/container/* -> internal/container/* (podman, security tests) - tests/unit/envpool/* -> internal/envpool/* (envpool tests) - tests/unit/errors/* -> internal/errtypes/* (errors_test.go moved to errtypes package) - tests/unit/experiment/* -> internal/experiment/* (manager tests) - tests/unit/jupyter/* -> internal/jupyter/* (config, package_blacklist, service_manager, trash_restore) Update import paths in test files to reflect new locations. Note: errors_test.go moved from tests/unit/errors/ to internal/errtypes/ to match the package structure.
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package config_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/jfraeys/fetch_ml/internal/config"
|
|
)
|
|
|
|
func TestModeBasedPaths(t *testing.T) {
|
|
tests := []struct {
|
|
mode string
|
|
wantBasePath string
|
|
wantDataDir string
|
|
wantLogDir string
|
|
}{
|
|
{"dev", "data/dev/experiments", "data/dev/active", "data/dev/logs"},
|
|
{"prod", "data/prod/experiments", "data/prod/active", "data/prod/logs"},
|
|
{"ci", "data/ci/experiments", "data/ci/active", "data/ci/logs"},
|
|
{"prod-smoke", "data/prod-smoke/experiments", "data/prod-smoke/active", "data/prod-smoke/logs"},
|
|
{"unknown", "data/dev/experiments", "data/dev/active", "data/dev/logs"}, // defaults to dev
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.mode, func(t *testing.T) {
|
|
gotBasePath := config.ModeBasedBasePath(tt.mode)
|
|
if gotBasePath != tt.wantBasePath {
|
|
t.Errorf("ModeBasedBasePath(%q) = %q, want %q", tt.mode, gotBasePath, tt.wantBasePath)
|
|
}
|
|
|
|
gotDataDir := config.ModeBasedDataDir(tt.mode)
|
|
if gotDataDir != tt.wantDataDir {
|
|
t.Errorf("ModeBasedDataDir(%q) = %q, want %q", tt.mode, gotDataDir, tt.wantDataDir)
|
|
}
|
|
|
|
gotLogDir := config.ModeBasedLogDir(tt.mode)
|
|
if gotLogDir != tt.wantLogDir {
|
|
t.Errorf("ModeBasedLogDir(%q) = %q, want %q", tt.mode, gotLogDir, tt.wantLogDir)
|
|
}
|
|
})
|
|
}
|
|
}
|