Centralize managed state targets
This commit is contained in:
@@ -116,21 +116,28 @@ func TestBackendManagedDeletion(t *testing.T) {
|
||||
backend := New()
|
||||
mustWrite(t, backend, "bundle/report.html", "html")
|
||||
mustWrite(t, backend, "bundle/keep.txt", "keep")
|
||||
mustWrite(t, backend, "bundle/.distributor.json", "{}")
|
||||
statePath, err := storage.StatePath("bundle")
|
||||
if err != nil {
|
||||
t.Fatalf("StatePath() error = %v", err)
|
||||
}
|
||||
mustWrite(t, backend, statePath, "{}")
|
||||
|
||||
err := backend.DeleteManagedBundle(context.Background(), "bundle", []string{"report.html"}, storage.DeleteOptions{PruneEmptyDirs: true})
|
||||
err = backend.DeleteManagedBundle(context.Background(), "bundle", []string{"report.html"}, storage.DeleteOptions{PruneEmptyDirs: true})
|
||||
if err != nil {
|
||||
t.Fatalf("DeleteManagedBundle() error = %v", err)
|
||||
}
|
||||
if _, err := backend.Stat(context.Background(), "bundle/report.html"); !storage.IsNotFound(err) {
|
||||
t.Fatalf("managed output stat error = %v, want not found", err)
|
||||
}
|
||||
if _, err := backend.Stat(context.Background(), "bundle/.distributor.json"); !storage.IsNotFound(err) {
|
||||
if _, err := backend.Stat(context.Background(), statePath); !storage.IsNotFound(err) {
|
||||
t.Fatalf("state stat error = %v, want not found", err)
|
||||
}
|
||||
if _, err := backend.Stat(context.Background(), "bundle/keep.txt"); err != nil {
|
||||
t.Fatalf("unlisted file stat error = %v", err)
|
||||
}
|
||||
if err := backend.DeleteManagedBundle(context.Background(), "bundle", []string{""}, storage.DeleteOptions{}); !storage.IsInvalidPath(err) {
|
||||
t.Fatalf("DeleteManagedBundle invalid output error = %v, want invalid path", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBackendHasAnyAndWalkStop(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user