Test that the deployment log path has no hostname in it (closes #214)
Check / check (pull_request) Skipped
Check / check (pull_request) Skipped
GetLogFilePath must return a path directly under logs/<appname>/; the new test fails if the hostname directory comes back. Model: opus-5-5
This commit is contained in:
@@ -69,6 +69,27 @@ func TestHandleDeploymentLogDownloadServesLegitimateFile(t *testing.T) {
|
|||||||
assert.Contains(t, recorder.Body.String(), "deploy log contents")
|
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
|
// TestHandleDeploymentLogDownloadServesLogFromOldHostnameDir verifies a
|
||||||
// log written by an older version, under the hostname of a container that
|
// log written by an older version, under the hostname of a container that
|
||||||
// has since been recreated, can still be downloaded.
|
// has since been recreated, can still be downloaded.
|
||||||
|
|||||||
Reference in New Issue
Block a user