Phase 13, part 5: each team's jobs, locks, files and sign-ins
Background jobs run for each active team on its own Server and under its own locks, a few teams at a time and from a different team each round, so the work is shared between copies of the app and no team holds up another. Each team's files are under its own prefix, and an OAuth sign-in comes back only to the team that started it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -183,3 +183,27 @@ func TestS3WrongKey(t *testing.T) {
|
||||
t.Fatalf("check: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnder(t *testing.T) {
|
||||
base, err := Open(config.Storage{Dir: t.TempDir()})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
a, b := Under(base, "teams/1"), Under(base, "teams/2/")
|
||||
if err := a.Put(ctx, "photos/x.png", strings.NewReader("A"), 1); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := b.Stat(ctx, "photos/x.png"); err == nil {
|
||||
t.Error("team 2 sees team 1's file")
|
||||
}
|
||||
if i, err := base.Stat(ctx, "teams/1/photos/x.png"); err != nil || i.Size != 1 {
|
||||
t.Errorf("in the store: %+v %v", i, err)
|
||||
}
|
||||
if list, _ := a.List(ctx, "photos/"); len(list) != 1 || list[0].Key != "photos/x.png" {
|
||||
t.Errorf("list %+v", list)
|
||||
}
|
||||
if err := a.Put(ctx, "../2/photos/y.png", strings.NewReader("x"), 1); err == nil {
|
||||
t.Error("reached outside its prefix")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user