Isolate CI database journey and stabilize E2E dependency cache
This commit is contained in:
1 parent
82bf015283
commit
bbd629dcf8
3 files changed
+45
-4
No files matched your search
@@ -25,16 +25,18 @@ func TestUploadedArtistPortraitStagingLifetime(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
pool, err := db.Connect(ctx, address)
|
||||
require.NoError(t, err)
|
||||
defer pool.Close()
|
||||
t.Cleanup(pool.Close)
|
||||
require.NoError(t, db.Migrate(ctx, pool))
|
||||
store := NewStore(pool)
|
||||
author := uuid.New()
|
||||
_, err = pool.Exec(ctx, `INSERT INTO users(id,username,password_hash,role) VALUES($1,$2,'x','admin')`, author, "portrait-"+author.String())
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(func() {
|
||||
_, _ = pool.Exec(ctx, `DELETE FROM upload_batches WHERE author_id=$1`, author)
|
||||
_, _ = pool.Exec(ctx, `DELETE FROM users WHERE id=$1`, author)
|
||||
_ = store.ReconcileQuota(ctx)
|
||||
_, err := pool.Exec(ctx, `DELETE FROM upload_batches WHERE author_id=$1`, author)
|
||||
require.NoError(t, err)
|
||||
_, err = pool.Exec(ctx, `DELETE FROM users WHERE id=$1`, author)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, store.ReconcileQuota(ctx))
|
||||
})
|
||||
svc := NewService(store, nil, nil, nil, nil, nil, library.FPCalc{}, Config{StagingDir: t.TempDir()}, slog.New(slog.DiscardHandler))
|
||||
owner := auth.WithPrincipal(ctx, auth.Principal{UserID: author, Role: auth.RoleAdmin})
|
||||
|
||||
Reference in new issue
Block a user