Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3d08d0e

Browse files
chore: only set status if not set, and run create in test
1 parent 54aa84a commit 3d08d0e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

agent/agentcontainers/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func WithDevcontainers(devcontainers []codersdk.WorkspaceAgentDevcontainer, scri
207207
api.devcontainerNames = make(map[string]bool, len(devcontainers))
208208
api.devcontainerLogSourceIDs = make(map[string]uuid.UUID)
209209
for _, dc := range devcontainers {
210-
if dc.Status == codersdk.WorkspaceAgentDevcontainerStatusStopped {
210+
if dc.Status == "" {
211211
dc.Status = codersdk.WorkspaceAgentDevcontainerStatusStarting
212212
}
213213

agent/agentcontainers/api_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,7 @@ func TestAPI(t *testing.T) {
10121012
apiOptions := []agentcontainers.Option{
10131013
agentcontainers.WithClock(mClock),
10141014
agentcontainers.WithContainerCLI(tt.lister),
1015+
agentcontainers.WithDevcontainerCLI(&fakeDevcontainerCLI{}),
10151016
agentcontainers.WithWatcher(watcher.NewNoop()),
10161017
}
10171018

@@ -1041,6 +1042,11 @@ func TestAPI(t *testing.T) {
10411042
tickerTrap.MustWait(ctx).MustRelease(ctx)
10421043
tickerTrap.Close()
10431044

1045+
for _, dc := range tt.knownDevcontainers {
1046+
err := api.CreateDevcontainer(dc.WorkspaceFolder, dc.ConfigPath)
1047+
require.NoError(t, err)
1048+
}
1049+
10441050
// Advance the clock to run the updater loop.
10451051
_, aw := mClock.AdvanceNext()
10461052
aw.MustWait(ctx)

0 commit comments

Comments
 (0)