Skip to content

feat(site): add agent connection timings #15276

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 20 commits into from
Nov 1, 2024
Merged
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
Improve tests
  • Loading branch information
BrunoQuaresma committed Oct 30, 2024
commit 0b685a93d1e288d187824228e66bdd433e79654f
25 changes: 17 additions & 8 deletions coderd/workspacebuilds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1183,8 +1183,9 @@ func TestPostWorkspaceBuild(t *testing.T) {
})
}

//nolint:paralleltest
func TestWorkspaceBuildTimings(t *testing.T) {
t.Parallel()

// Setup the test environment with a template and version
db, pubsub := dbtestutil.NewDB(t)
client := coderdtest.New(t, &coderdtest.Options{
Expand Down Expand Up @@ -1237,8 +1238,9 @@ func TestWorkspaceBuildTimings(t *testing.T) {
})
}

//nolint:paralleltest
t.Run("NonExistentBuild", func(t *testing.T) {
t.Parallel()

// Given: a non-existent build
buildID := uuid.New()

Expand All @@ -1252,8 +1254,9 @@ func TestWorkspaceBuildTimings(t *testing.T) {
require.Contains(t, err.Error(), "not found")
})

//nolint:paralleltest
t.Run("EmptyTimings", func(t *testing.T) {
t.Parallel()

// Given: a build with no timings
build := makeBuild()

Expand All @@ -1268,8 +1271,9 @@ func TestWorkspaceBuildTimings(t *testing.T) {
require.Empty(t, res.AgentScriptTimings)
})

//nolint:paralleltest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why were these marked as not parallel before? I'm concerned we're rolling back a change which was necessary to avoid some previous issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t.Run("ProvisionerTimings", func(t *testing.T) {
t.Parallel()

// Given: a build with provisioner timings
build := makeBuild()
provisionerTimings := dbgen.ProvisionerJobTimings(t, db, build, 5)
Expand All @@ -1295,8 +1299,9 @@ func TestWorkspaceBuildTimings(t *testing.T) {
}
})

//nolint:paralleltest
t.Run("AgentScriptTimings", func(t *testing.T) {
t.Parallel()

// Given: a build with agent script timings
build := makeBuild()
resource := dbgen.WorkspaceResource(t, db, database.WorkspaceResource{
Expand Down Expand Up @@ -1331,8 +1336,9 @@ func TestWorkspaceBuildTimings(t *testing.T) {
}
})

//nolint:paralleltest
t.Run("NoAgentScripts", func(t *testing.T) {
t.Parallel()

// Given: a build with no agent scripts
build := makeBuild()
resource := dbgen.WorkspaceResource(t, db, database.WorkspaceResource{
Expand All @@ -1353,8 +1359,9 @@ func TestWorkspaceBuildTimings(t *testing.T) {
})

// Some workspaces might not have agents. It is improbable, but possible.
//nolint:paralleltest
t.Run("NoAgents", func(t *testing.T) {
t.Parallel()

// Given: a build with no agents
build := makeBuild()
dbgen.WorkspaceResource(t, db, database.WorkspaceResource{
Expand All @@ -1369,10 +1376,12 @@ func TestWorkspaceBuildTimings(t *testing.T) {

// Then: return a response with empty agent script timings
require.Empty(t, res.AgentScriptTimings)
require.Empty(t, res.AgentConnectionTimings)
})

//nolint:paralleltest
t.Run("AgentConnectionTimings", func(t *testing.T) {
t.Parallel()

// Given: a build with multiple agents
build := makeBuild()
resource := dbgen.WorkspaceResource(t, db, database.WorkspaceResource{
Expand Down
Loading