Compare commits
2 Commits
feature/de
...
71809fd623
| Author | SHA1 | Date | |
|---|---|---|---|
| 71809fd623 | |||
|
|
9a4ec5ba8c |
6
TODO.md
6
TODO.md
@@ -116,7 +116,7 @@
|
|||||||
- [x] Deployment history page
|
- [x] Deployment history page
|
||||||
- [x] Login page
|
- [x] Login page
|
||||||
- [x] Setup page
|
- [x] Setup page
|
||||||
- [ ] Container logs page
|
- [x] Container logs page
|
||||||
- [ ] Webhook event history page
|
- [ ] Webhook event history page
|
||||||
- [ ] Settings page (webhook secret, SSH public key)
|
- [ ] Settings page (webhook secret, SSH public key)
|
||||||
- [ ] Real-time deployment log streaming (WebSocket/SSE)
|
- [ ] Real-time deployment log streaming (WebSocket/SSE)
|
||||||
@@ -210,9 +210,9 @@ Protected Routes (require auth):
|
|||||||
- [ ] Update deploy service to save previous image before building new one
|
- [ ] Update deploy service to save previous image before building new one
|
||||||
|
|
||||||
### 3.3 Deployment Cancellation
|
### 3.3 Deployment Cancellation
|
||||||
- [ ] Add cancellation context to deploy service
|
- [x] Add cancellation context to deploy service
|
||||||
- [ ] Add `POST /apps/:id/deployments/:id/cancel` endpoint
|
- [ ] Add `POST /apps/:id/deployments/:id/cancel` endpoint
|
||||||
- [ ] Handle cleanup of partial builds/containers
|
- [x] Handle cleanup of partial builds/containers
|
||||||
|
|
||||||
## Phase 4: Lower Priority (Nice to Have)
|
## Phase 4: Lower Priority (Nice to Have)
|
||||||
|
|
||||||
|
|||||||
@@ -1,74 +0,0 @@
|
|||||||
package deploy_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"database/sql"
|
|
||||||
"log/slog"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
|
|
||||||
"git.eeqj.de/sneak/upaas/internal/models"
|
|
||||||
"git.eeqj.de/sneak/upaas/internal/service/deploy"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestRollback_NoPreviousImage(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
svc := deploy.NewTestService(slog.Default())
|
|
||||||
app := &models.App{
|
|
||||||
ID: "app-rollback-1",
|
|
||||||
PreviousImageID: sql.NullString{},
|
|
||||||
}
|
|
||||||
|
|
||||||
err := svc.Rollback(context.Background(), app)
|
|
||||||
assert.ErrorIs(t, err, deploy.ErrNoPreviousImage)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestRollback_EmptyPreviousImage(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
svc := deploy.NewTestService(slog.Default())
|
|
||||||
app := &models.App{
|
|
||||||
ID: "app-rollback-2",
|
|
||||||
PreviousImageID: sql.NullString{String: "", Valid: true},
|
|
||||||
}
|
|
||||||
|
|
||||||
err := svc.Rollback(context.Background(), app)
|
|
||||||
assert.ErrorIs(t, err, deploy.ErrNoPreviousImage)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestRollback_DeploymentLocked(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
svc := deploy.NewTestService(slog.Default())
|
|
||||||
|
|
||||||
// Simulate a deploy holding the lock
|
|
||||||
assert.True(t, svc.TryLockApp("app-rollback-3"))
|
|
||||||
defer svc.UnlockApp("app-rollback-3")
|
|
||||||
|
|
||||||
app := &models.App{
|
|
||||||
ID: "app-rollback-3",
|
|
||||||
PreviousImageID: sql.NullString{String: "sha256:abc123", Valid: true},
|
|
||||||
}
|
|
||||||
|
|
||||||
err := svc.Rollback(context.Background(), app)
|
|
||||||
assert.ErrorIs(t, err, deploy.ErrDeploymentInProgress)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestRollback_LockedApp(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
svc := deploy.NewTestService(slog.Default())
|
|
||||||
|
|
||||||
assert.True(t, svc.TryLockApp("app-rollback-4"))
|
|
||||||
defer svc.UnlockApp("app-rollback-4")
|
|
||||||
|
|
||||||
app := &models.App{
|
|
||||||
ID: "app-rollback-4",
|
|
||||||
PreviousImageID: sql.NullString{String: "sha256:abc123", Valid: true},
|
|
||||||
}
|
|
||||||
|
|
||||||
err := svc.Rollback(context.Background(), app)
|
|
||||||
assert.ErrorIs(t, err, deploy.ErrDeploymentInProgress)
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user