From 53da6563253520ca99aaf1475d654a384b46d9ef Mon Sep 17 00:00:00 2001 From: sneak Date: Wed, 23 Sep 2026 09:26:04 +0000 Subject: [PATCH] Test that the deployment log path has no hostname in it (closes #214) GetLogFilePath must return a path directly under logs//; the new test fails if the hostname directory comes back. Model: opus-5-5 --- internal/handlers/log_download_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/internal/handlers/log_download_test.go b/internal/handlers/log_download_test.go index 781fd83..595fbee 100644 --- a/internal/handlers/log_download_test.go +++ b/internal/handlers/log_download_test.go @@ -69,6 +69,27 @@ func TestHandleDeploymentLogDownloadServesLegitimateFile(t *testing.T) { assert.Contains(t, recorder.Body.String(), "deploy log contents") } +// TestGetLogFilePathHasNoHostname verifies a deployment log is stored +// directly under logs//, with no hostname directory in between, +// so it is still found after the container is recreated with a new +// hostname. +func TestGetLogFilePathHasNoHostname(t *testing.T) { + t.Parallel() + + testCtx := setupTestHandlers(t) + createdApp := createTestApp(t, testCtx, "log-path-app") + + deployment := models.NewDeployment(testCtx.database) + deployment.AppID = createdApp.ID + + logPath := testCtx.deploySvc.GetLogFilePath(createdApp, deployment) + + assert.Equal(t, + filepath.Join(testCtx.deploySvc.GetLogDir(), createdApp.Name), + filepath.Dir(logPath), + ) +} + // TestHandleDeploymentLogDownloadServesLogFromOldHostnameDir verifies a // log written by an older version, under the hostname of a container that // has since been recreated, can still be downloaded.