mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
Filter query: has-agent connecting, connected, disconnected, timeout (#5145)
* WIP * has-agent:connecting, connected * Fix * Fix * has-agent:disconnected, timeout * Fix: typo * Fix * TODOs * databasefake * Fix: typo * More TODOs * databasefake * Timeout tests * Address PR comments * Implement FIXMEs * Renamings * Address PR comments * Fix: readability * Fix: refactor CASE logic * CASE logic * Fix * Use CTE * Polishing * Comment * WIP * IS NOT NULL * Without CTE * One more optimization * 2nd optimization
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/coder/coder/coderd/database"
|
||||
"github.com/coder/coder/codersdk"
|
||||
@ -136,7 +137,7 @@ func TestSearchWorkspace(t *testing.T) {
|
||||
c := c
|
||||
t.Run(c.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
values, errs := workspaceSearchQuery(c.Query, codersdk.Pagination{})
|
||||
values, errs := workspaceSearchQuery(c.Query, codersdk.Pagination{}, 0)
|
||||
if c.ExpectedErrorContains != "" {
|
||||
require.True(t, len(errs) > 0, "expect some errors")
|
||||
var s strings.Builder
|
||||
@ -150,4 +151,13 @@ func TestSearchWorkspace(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
t.Run("AgentInactiveDisconnectTimeout", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
query := `foo:bar`
|
||||
timeout := 1337 * time.Second
|
||||
values, errs := workspaceSearchQuery(query, codersdk.Pagination{}, timeout)
|
||||
require.Empty(t, errs)
|
||||
require.Equal(t, int64(timeout.Seconds()), values.AgentInactiveDisconnectTimeoutSeconds)
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user