Skip to content

chore: Add test helpers to improve coverage #166

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 18 commits into from
Feb 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Cache npm dependencies with setup node
  • Loading branch information
kylecarbs committed Feb 5, 2022
commit a4d17d0dbd295a2a407f4b740c9dbef94ce73b79
6 changes: 4 additions & 2 deletions .github/workflows/coder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,20 @@ jobs:
-covermode=atomic -coverprofile="gotests.coverage" -timeout=3m
-count=1 -race -parallel=2

- uses: actions/setup-node@v2
- name: Setup Node for DataDog CLI
uses: actions/setup-node@v2
if: always() && github.actor != 'dependabot[bot]'
with:
node-version: "14"

- name: Cache DataDog CI
- name: Cache DataDog CLI
if: always() && github.actor != 'dependabot[bot]'
uses: actions/cache@v2
with:
path: |
~/.npm
%LocalAppData%\npm-cache
C:\npm
key: datadogci-
restore-keys: datadogci-

Expand Down
20 changes: 0 additions & 20 deletions coderd/workspacehistory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,6 @@ func TestPostWorkspaceHistoryByUser(t *testing.T) {
require.Equal(t, http.StatusBadRequest, apiErr.StatusCode())
})

t.Run("ProjectVersionImporting", func(t *testing.T) {
t.Parallel()
client := coderdtest.New(t)
user := coderdtest.CreateInitialUser(t, client)
coderdtest.NewProvisionerDaemon(t, client)
project := coderdtest.CreateProject(t, client, user.Organization)
workspace := coderdtest.CreateWorkspace(t, client, "me", project.ID)
version := coderdtest.CreateProjectVersion(t, client, user.Organization, project.Name, &echo.Responses{
Provision: []*proto.Provision_Response{{}},
})
_, err := client.CreateWorkspaceHistory(context.Background(), "", workspace.Name, coderd.CreateWorkspaceHistoryRequest{
ProjectVersionID: version.ID,
Transition: database.WorkspaceTransitionCreate,
})
require.Error(t, err)
var apiErr *codersdk.Error
require.ErrorAs(t, err, &apiErr)
require.Equal(t, http.StatusNotAcceptable, apiErr.StatusCode())
})

t.Run("ProjectVersionFailedImport", func(t *testing.T) {
t.Parallel()
client := coderdtest.New(t)
Expand Down