Skip to content

Commit 8ef85c8

Browse files
committed
order by name
1 parent 83773bd commit 8ef85c8

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

cli/templatepush_test.go

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,8 @@ func TestTemplatePush(t *testing.T) {
546546
require.NoError(t, tt.setupDaemon(setupCtx, store, owner, wantTags, now))
547547

548548
ctx := testutil.Context(t, testutil.WaitMedium)
549-
cancelCtx, cancel := context.WithCancel(ctx)
550-
defer cancel()
551-
inv = inv.WithContext(cancelCtx)
552-
w := clitest.StartWithWaiter(t, inv)
549+
inv = inv.WithContext(ctx)
550+
clitest.Start(t, inv) // Only used for output, disregard exit status.
553551

554552
require.Eventually(t, func() bool {
555553
jobs, err := store.GetProvisionerJobsCreatedAfter(ctx, time.Time{})
@@ -565,9 +563,6 @@ func TestTemplatePush(t *testing.T) {
565563
if tt.expectOutput != "" {
566564
pty.ExpectMatchContext(ctx, tt.expectOutput)
567565
}
568-
569-
cancel()
570-
_ = w.Wait()
571566
})
572567
}
573568
})
@@ -1106,21 +1101,22 @@ func TestTemplatePush(t *testing.T) {
11061101
pty.ExpectMatchContext(ctx, "Upload")
11071102
pty.WriteLine("yes")
11081103

1109-
pty.ExpectMatchContext(ctx, "var.string_var")
1110-
pty.ExpectMatchContext(ctx, "Enter value:")
1111-
pty.WriteLine("test-string")
1104+
// Variables are prompted in alphabetical order.
1105+
// Boolean variable automatically selects the first option ("true")
1106+
pty.ExpectMatchContext(ctx, "var.bool_var")
11121107

11131108
pty.ExpectMatchContext(ctx, "var.number_var")
11141109
pty.ExpectMatchContext(ctx, "Enter value:")
11151110
pty.WriteLine("42")
11161111

1117-
// Boolean variable automatically selects the first option ("true")
1118-
pty.ExpectMatchContext(ctx, "var.bool_var")
1119-
11201112
pty.ExpectMatchContext(ctx, "var.sensitive_var")
11211113
pty.ExpectMatchContext(ctx, "Enter value:")
11221114
pty.WriteLine("secret-value")
11231115

1116+
pty.ExpectMatchContext(ctx, "var.string_var")
1117+
pty.ExpectMatchContext(ctx, "Enter value:")
1118+
pty.WriteLine("test-string")
1119+
11241120
w.RequireSuccess()
11251121
})
11261122

coderd/database/queries.sql.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/templateversionvariables.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ VALUES
2323
) RETURNING *;
2424

2525
-- name: GetTemplateVersionVariables :many
26-
SELECT * FROM template_version_variables WHERE template_version_id = $1;
26+
SELECT * FROM template_version_variables WHERE template_version_id = $1 ORDER BY name;

0 commit comments

Comments
 (0)