From d86705c11a6182462b6a3f2303a6bcfe73c752c4 Mon Sep 17 00:00:00 2001 From: Louis Garman Date: Wed, 1 Jan 2025 18:27:51 +0000 Subject: [PATCH] fix(ui): bad db query broke runner listing --- .../templates/partials/runner_item.tmpl | 2 +- internal/integration/runners_ui_test.go | 29 +++++++++++++++++++ internal/sql/queries/runner.sql | 1 + internal/sql/sqlc/runner.sql.go | 1 + 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 internal/integration/runners_ui_test.go diff --git a/internal/http/html/static/templates/partials/runner_item.tmpl b/internal/http/html/static/templates/partials/runner_item.tmpl index c3c729671..fc69ed6fb 100644 --- a/internal/http/html/static/templates/partials/runner_item.tmpl +++ b/internal/http/html/static/templates/partials/runner_item.tmpl @@ -21,7 +21,7 @@ {{ template "identifier" . }}
{{ .Version }} - {{ if .IsAgent }}otf-agent{{ else }}otfd{{ end }} + {{ if .IsAgent }}otf-agent{{ else }}otfd{{ end }} {{ .IPAddress }}
diff --git a/internal/integration/runners_ui_test.go b/internal/integration/runners_ui_test.go new file mode 100644 index 000000000..19e675864 --- /dev/null +++ b/internal/integration/runners_ui_test.go @@ -0,0 +1,29 @@ +package integration + +import ( + "testing" + + "github.com/playwright-community/playwright-go" + "github.com/stretchr/testify/require" +) + +// TestRunnersUI demonstrates managing runners via the UI +func TestRunnersUI(t *testing.T) { + integrationTest(t) + + daemon, org, ctx := setup(t, nil) + + browser.New(t, ctx, func(page playwright.Page) { + // go to org main menu + _, err := page.Goto(organizationURL(daemon.System.Hostname(), org.Name)) + require.NoError(t, err) + + // to list of runners + err = page.Locator("#runners > a").Click() + require.NoError(t, err) + + // expect otfd server to be listed as one and only runner + err = expect.Locator(page.Locator(`#process-name`)).ToContainText(`otfd`) + require.NoError(t, err) + }) +} diff --git a/internal/sql/queries/runner.sql b/internal/sql/queries/runner.sql index 8c27c5cc6..619ef852e 100644 --- a/internal/sql/queries/runner.sql +++ b/internal/sql/queries/runner.sql @@ -80,6 +80,7 @@ SELECT AND j.status IN ('allocated', 'running') ) AS current_jobs FROM runners a +LEFT JOIN agent_pools ap USING (agent_pool_id) WHERE agent_pool_id IS NULL ORDER BY last_ping_at DESC; diff --git a/internal/sql/sqlc/runner.sql.go b/internal/sql/sqlc/runner.sql.go index ff1a895e5..6ccec0dc0 100644 --- a/internal/sql/sqlc/runner.sql.go +++ b/internal/sql/sqlc/runner.sql.go @@ -325,6 +325,7 @@ SELECT AND j.status IN ('allocated', 'running') ) AS current_jobs FROM runners a +LEFT JOIN agent_pools ap USING (agent_pool_id) WHERE agent_pool_id IS NULL ORDER BY last_ping_at DESC `