Download this file
| 1 | package vet |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "testing" |
| 6 | |
| 7 | "github.com/carlosframework/platform/internal/release" |
| 8 | ) |
| 9 | |
| 10 | // A deployment directory is a deployment like the bucket: the store the |
| 11 | // opener returns bumps the change index after a scoped write. |
| 12 | func TestDeployDirOpenerBumpsScopedKey(t *testing.T) { |
| 13 | t.Setenv("CARLOS_DEPLOYMENT_BUCKET", "") |
| 14 | t.Setenv("CARLOS_DEPLOYMENT_DIR", t.TempDir()) |
| 15 | ctx := context.Background() |
| 16 | s := openStore() |
| 17 | if _, err := s.Put(ctx, "accounts/shop/manifest.json", []byte("{}"), ""); err != nil { |
| 18 | t.Fatal(err) |
| 19 | } |
| 20 | idx, _, err := release.ReadChangeIndex(ctx, s) |
| 21 | if err != nil { |
| 22 | t.Fatal(err) |
| 23 | } |
| 24 | if got := idx.Entries["accounts/shop"]; got != 1 { |
| 25 | t.Fatalf("accounts/shop generation = %d after one scoped Put, want 1 (entries %v)", got, idx.Entries) |
| 26 | } |
| 27 | } |
| 28 | |