Check / check (pull_request) Successful in 4m35s
The hint under the app page's environment variable editor asked for a container restart. Environment variables are set when a container is created, and upaas's restart stops and starts the same container, so it keeps the old values; deploy and rollback each create a new container. The hint now says so in one sentence, styled with alert-warning like the page's Volume Mounts note: its old text-amber-600 class is not in the built stylesheet. A handler test renders the app page and checks the hint. Model: opus-5-5
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package handlers_test
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"sneak.berlin/go/upaas/internal/service/app"
|
|
)
|
|
|
|
// TestAppPageEnvVarHint checks that the environment variable editor says
|
|
// changes take effect at the next deploy or rollback, in the warning style.
|
|
func TestAppPageEnvVarHint(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
testCtx := setupTestHandlers(t)
|
|
|
|
createdApp, err := testCtx.appSvc.CreateApp(t.Context(), app.CreateAppInput{
|
|
Name: "env-hint-app",
|
|
RepoURL: "git@example.com:user/env-hint-app.git",
|
|
})
|
|
require.NoError(t, err)
|
|
|
|
request := httptest.NewRequestWithContext(
|
|
t.Context(), http.MethodGet, "/apps/"+createdApp.ID, nil,
|
|
)
|
|
request = addChiURLParams(request, map[string]string{"id": createdApp.ID})
|
|
recorder := httptest.NewRecorder()
|
|
|
|
testCtx.handlers.HandleAppDetail().ServeHTTP(recorder, request)
|
|
|
|
require.Equal(t, http.StatusOK, recorder.Code)
|
|
assert.Contains(t, recorder.Body.String(),
|
|
`<p class="alert-warning mt-1">`+
|
|
"Environment variable changes take effect at the next deploy or rollback.</p>")
|
|
}
|