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

Skip to content

feat: Add template display name (backend) #4966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Nov 10, 2022
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
03d8456
Rename to nameValidator
mtojek Nov 8, 2022
e3a1b7d
Merge branch 'main' into 3321-template-space-b
mtojek Nov 9, 2022
9c7cae6
Refactor: NameValid
mtojek Nov 9, 2022
5fac8e9
Fix: comment
mtojek Nov 9, 2022
61074d9
Define new migration
mtojek Nov 9, 2022
dbd96c0
Include display_name
mtojek Nov 9, 2022
bf26ba9
Update typesGenerated.ts
mtojek Nov 9, 2022
9a7d35f
Update meta
mtojek Nov 9, 2022
4aaff3e
Adjust tests
mtojek Nov 9, 2022
c3532a1
CLI tests
mtojek Nov 9, 2022
fa778d3
Fix: audit
mtojek Nov 9, 2022
64c6fe2
Fix: omitempty
mtojek Nov 9, 2022
b2c122b
site: display_name is optional
mtojek Nov 9, 2022
75c79d3
unit: TestUsernameValid
mtojek Nov 9, 2022
cfa4ca7
entities.ts: add display_name
mtojek Nov 9, 2022
9eb443e
site: TemplateSettingsPage.test.tsx
mtojek Nov 9, 2022
20018f8
Fix: TemplateSettingsForm.tsx
mtojek Nov 9, 2022
53c463d
Adjust tests
mtojek Nov 9, 2022
a24eac4
Add comment to display_name column
mtojek Nov 9, 2022
ed56c3b
Merge branch 'main' into 3321-template-space-b
mtojek Nov 9, 2022
7490d45
Fix: rename
mtojek Nov 9, 2022
88c6ddc
Fix: make
mtojek Nov 9, 2022
01dae76
Merge branch 'main' into 3321-template-space-b
mtojek Nov 10, 2022
361a428
Loosen regexp
mtojek Nov 10, 2022
d935a41
Fix: err check
mtojek Nov 10, 2022
a837fae
Fix: template name length
mtojek Nov 10, 2022
d32247d
Merge branch 'main' into 3321-template-space-b
mtojek Nov 10, 2022
2da0147
Allow for whitespaces
mtojek Nov 10, 2022
2301f5c
Merge branch 'main' into 3321-template-space-b
mtojek Nov 10, 2022
a3652b2
Update migration number
mtojek Nov 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adjust tests
  • Loading branch information
mtojek committed Nov 9, 2022
commit 53c463dc286980dc366d432940e744aa58533f84
17 changes: 13 additions & 4 deletions cli/templateedit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (

"github.com/coder/coder/cli/clitest"
"github.com/coder/coder/coderd/coderdtest"
"github.com/coder/coder/codersdk"
"github.com/coder/coder/testutil"
)

func TestTemplateEdit(t *testing.T) {
Expand Down Expand Up @@ -44,7 +46,8 @@ func TestTemplateEdit(t *testing.T) {
cmd, root := clitest.New(t, cmdArgs...)
clitest.SetupConfig(t, client, root)

err := cmd.Execute()
ctx, _ := testutil.Context(t)
err := cmd.ExecuteContext(ctx)

require.NoError(t, err)

Expand Down Expand Up @@ -80,7 +83,8 @@ func TestTemplateEdit(t *testing.T) {
cmd, root := clitest.New(t, cmdArgs...)
clitest.SetupConfig(t, client, root)

err := cmd.Execute()
ctx, _ := testutil.Context(t)
err := cmd.ExecuteContext(ctx)

require.ErrorContains(t, err, "not modified")

Expand Down Expand Up @@ -112,9 +116,14 @@ func TestTemplateEdit(t *testing.T) {
cmd, root := clitest.New(t, cmdArgs...)
clitest.SetupConfig(t, client, root)

err := cmd.Execute()
ctx, _ := testutil.Context(t)
err := cmd.ExecuteContext(ctx)

require.ErrorContains(t, err, `Validation failed for tag "template_display_name"`)
require.Error(t, err, "client call must fail")
sdkError, isSdkError := codersdk.AsError(err)
require.True(t, isSdkError, "sdk error is expected")
require.Len(t, sdkError.Response.Validations, 1, "field validation error is expected")
require.Equal(t, sdkError.Response.Validations[0].Detail, `Validation failed for tag "template_display_name" with value: "a-b-c"`)

// Assert that the template metadata did not change.
updated, err := client.Template(context.Background(), template.ID)
Expand Down