Keep deployment logs findable after the container is recreated #218

Merged
clawbot merged 2 commits from issue-214-log-hostname into next2 2026-09-23 11:44:30 +02:00
Showing only changes of commit 53da656325 - Show all commits
+21
View File
@@ -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/<appname>/, 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.