Skip to content

Commit 4af6f45

Browse files
use defang -C
1 parent d9648ba commit 4af6f45

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

tools/testing/deployer/deployer.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,7 @@ func (d *CliDeployer) RunDeployTest(ctx context.Context, t test.TestInfo) (*test
155155
},
156156
}
157157

158-
wkdir, err := os.Getwd()
159-
if err != nil {
160-
return nil, fmt.Errorf("failed to get current working directory: %w", err)
161-
}
162-
err = os.Chdir("/")
163-
if err != nil {
164-
return nil, fmt.Errorf("failed to change working directory: %w", err)
165-
}
166-
_, err = d.RunCommand(cmdCtx, func(cmd *exec.Cmd) {
158+
d.RunCommand(cmdCtx, func(cmd *exec.Cmd) {
167159
if t.Stdout != nil {
168160
cmd.Stdout = io.MultiWriter(&d.Stdout, t.Stdout, detector)
169161
} else {
@@ -177,14 +169,7 @@ func (d *CliDeployer) RunDeployTest(ctx context.Context, t test.TestInfo) (*test
177169
cmd.Cancel = func() error {
178170
return cmd.Process.Signal(os.Interrupt) // Use interrupt signal to stop the command when context is cancelled
179171
}
180-
}, "defang", "compose", "down", "--detach")
181-
if err != nil {
182-
return nil, fmt.Errorf("failed to run compose down: %w", err)
183-
}
184-
err = os.Chdir(wkdir)
185-
if err != nil {
186-
return nil, fmt.Errorf("failed to change working directory: %w", err)
187-
}
172+
}, "defang", "-C", "/tmp/", "compose", "down", "--detach")
188173

189174
d.HasDeployed = true
190175
start := time.Now()

0 commit comments

Comments
 (0)