Skip to content

feat: support order property of coder_app resource #12077

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 16 commits into from
Feb 12, 2024
Prev Previous commit
Next Next commit
better test
  • Loading branch information
mtojek committed Feb 12, 2024
commit 0584d15468a44e0b66eb5391ca39a52254137d6f
15 changes: 12 additions & 3 deletions coderd/workspaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2552,6 +2552,10 @@ func TestWorkspaceResource(t *testing.T) {
})
user := coderdtest.CreateFirstUser(t, client)
apps := []*proto.App{
{
Slug: "aaa",
DisplayName: "aaa",
},
{
Slug: "aaa-code-server",
Order: 4,
Expand All @@ -2560,6 +2564,9 @@ func TestWorkspaceResource(t *testing.T) {
Slug: "bbb-code-server",
Order: 3,
},
{
Slug: "bbb",
},
}
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
Parse: echo.ParseComplete,
Expand Down Expand Up @@ -2591,9 +2598,11 @@ func TestWorkspaceResource(t *testing.T) {
require.NoError(t, err)
require.Len(t, workspace.LatestBuild.Resources[0].Agents, 1)
agent := workspace.LatestBuild.Resources[0].Agents[0]
require.Len(t, agent.Apps, 2)
require.Equal(t, apps[1].Slug, agent.Apps[0].Slug)
require.Equal(t, apps[0].Slug, agent.Apps[1].Slug)
require.Len(t, agent.Apps, 4)
require.Equal(t, "bbb", agent.Apps[0].Slug) // empty-display-name < "aaa"
require.Equal(t, "aaa", agent.Apps[1].Slug) // no order < any order
require.Equal(t, "bbb-code-server", agent.Apps[2].Slug) // order = 3 < order = 4
require.Equal(t, "aaa-code-server", agent.Apps[3].Slug)
})

t.Run("Metadata", func(t *testing.T) {
Expand Down