mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-19 17:59:05 -05:00
fix cmd/tofu tests by using t.Chdir instead of os.Chdir (#3285)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
This commit is contained in:
committed by
GitHub
parent
197135b4af
commit
ff9657f5b7
@@ -100,17 +100,11 @@ func TestProviderSource(t *testing.T) {
|
||||
// Setup test environment
|
||||
originalWorkingDir, overrideWd := tt.setupFunc(t)
|
||||
|
||||
err := os.Chdir(originalWorkingDir)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to change to original working directory: %v", err)
|
||||
}
|
||||
t.Chdir(originalWorkingDir)
|
||||
|
||||
// If we have an override directory, change to it (simulating -chdir behavior)
|
||||
if overrideWd != "" {
|
||||
err := os.Chdir(overrideWd)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to change to override directory: %v", err)
|
||||
}
|
||||
t.Chdir(overrideWd)
|
||||
}
|
||||
|
||||
// Create a mock disco service
|
||||
|
||||
Reference in New Issue
Block a user