Revert "fix: change auto-start to automatically update workspaces (#6053)" (#7084)

This reverts commit bdddc3e7ae.
This commit is contained in:
Marcin Tojek
2023-04-11 16:14:35 +02:00
committed by GitHub
parent 9d39371ee0
commit 3b10e89047
2 changed files with 3 additions and 3 deletions

View File

@ -308,7 +308,7 @@ func build(ctx context.Context, store database.Store, workspace database.Workspa
CreatedAt: now, CreatedAt: now,
UpdatedAt: now, UpdatedAt: now,
WorkspaceID: workspace.ID, WorkspaceID: workspace.ID,
TemplateVersionID: template.ActiveVersionID, TemplateVersionID: priorHistory.TemplateVersionID,
BuildNumber: priorBuildNumber + 1, BuildNumber: priorBuildNumber + 1,
ProvisionerState: priorHistory.ProvisionerState, ProvisionerState: priorHistory.ProvisionerState,
InitiatorID: workspace.OwnerID, InitiatorID: workspace.OwnerID,

View File

@ -97,14 +97,14 @@ func TestExecutorAutostartTemplateUpdated(t *testing.T) {
close(tickCh) close(tickCh)
}() }()
// Then: the workspace is started using the new template version, not the old one. // Then: the workspace should be started using the previous template version, and not the updated version.
stats := <-statsCh stats := <-statsCh
assert.NoError(t, stats.Error) assert.NoError(t, stats.Error)
assert.Len(t, stats.Transitions, 1) assert.Len(t, stats.Transitions, 1)
assert.Contains(t, stats.Transitions, workspace.ID) assert.Contains(t, stats.Transitions, workspace.ID)
assert.Equal(t, database.WorkspaceTransitionStart, stats.Transitions[workspace.ID]) assert.Equal(t, database.WorkspaceTransitionStart, stats.Transitions[workspace.ID])
ws := coderdtest.MustWorkspace(t, client, workspace.ID) ws := coderdtest.MustWorkspace(t, client, workspace.ID)
assert.Equal(t, newVersion.ID, ws.LatestBuild.TemplateVersionID, "expected workspace build to be using the new template version") assert.Equal(t, workspace.LatestBuild.TemplateVersionID, ws.LatestBuild.TemplateVersionID, "expected workspace build to be using the old template version")
} }
func TestExecutorAutostartAlreadyRunning(t *testing.T) { func TestExecutorAutostartAlreadyRunning(t *testing.T) {