carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package host
2
3import (
4 "context"
5 "testing"
6
7 "github.com/carlosframework/platform/internal/release"
8)
9
10// A deployment directory (CARLOS_DEPLOYMENT_DIR) is a deployment like the
11// bucket: the opener's store bumps the change index after a scoped write.
12// getenv is injected, so nothing here touches the process environment.
13func TestDeployDirOpenerBumpsScopedKey(t *testing.T) {
14 t.Parallel()
15 ctx := context.Background()
16 dir := t.TempDir()
17 s, err := openDeployStoreEnv(ctx, envFunc(map[string]string{"CARLOS_DEPLOYMENT_DIR": dir}))
18 if err != nil {
19 t.Fatal(err)
20 }
21 if _, err := s.Put(ctx, "accounts/shop/manifest.json", []byte("{}"), ""); err != nil {
22 t.Fatal(err)
23 }
24 idx, _, err := release.ReadChangeIndex(ctx, s)
25 if err != nil {
26 t.Fatal(err)
27 }
28 if got := idx.Entries["accounts/shop"]; got != 1 {
29 t.Fatalf("accounts/shop generation = %d after one scoped Put, want 1 (entries %v)", got, idx.Entries)
30 }
31}
32