lab5 done
This commit is contained in:
@@ -259,7 +259,11 @@ func lab4Backend(t *testing.T, pool *pgxpool.Pool, repo *postgres.Storage, user
|
||||
fake.objects[orphan] = fakeObject{data: []byte("orphan"), modified: old}
|
||||
fake.objects[fresh] = fakeObject{data: []byte("fresh"), modified: time.Now()}
|
||||
fake.objects[locked] = fakeObject{data: []byte("locked"), modified: old}
|
||||
fake.objects["original/legacy-staging"] = fakeObject{data: []byte("legacy stage"), modified: old}
|
||||
fake.mu.Unlock()
|
||||
if _, err = pool.Exec(ctx, `UPDATE attachments SET staging_key='original/legacy-staging' WHERE id=$1`, second.ID); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err = pool.Exec(ctx, `UPDATE attachments SET created_at=$1 WHERE id=ANY($2::uuid[])`, old, []string{first.ID, second.ID}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -294,8 +298,9 @@ func lab4Backend(t *testing.T, pool *pgxpool.Pool, repo *postgres.Storage, user
|
||||
_, hasFresh := fake.objects[fresh]
|
||||
_, hasLinked := fake.objects[second.Key]
|
||||
_, hasLocked := fake.objects[locked]
|
||||
_, hasLegacyStage := fake.objects["original/legacy-staging"]
|
||||
fake.mu.Unlock()
|
||||
if hasOrphan || !hasFresh || !hasLinked || !hasLocked {
|
||||
if hasOrphan || !hasFresh || !hasLinked || !hasLocked || !hasLegacyStage {
|
||||
t.Fatal("unsafe object cleanup")
|
||||
}
|
||||
_, err = service.Get(ctx, first.ID, user.ID)
|
||||
|
||||
Reference in New Issue
Block a user