test(files): live CRUD папок + фасадный CRUD (#62)
Release Please / Release Please (push) Skipped
Release / GoReleaser (push) Skipped
Tests / Secret scan (gitleaks) (push) Skipped
Tests / Test (Go 1.25) (push) Skipped
Tests / Test (Go stable) (push) Skipped
Tests / Test (Go stable) (pull_request) Failing after 4s
Tests / Secret scan (gitleaks) (pull_request) Successful in 4s
Tests / Test (Go 1.25) (pull_request) Successful in 19s
Release Please / Release Please (push) Skipped
Release / GoReleaser (push) Skipped
Tests / Secret scan (gitleaks) (push) Skipped
Tests / Test (Go 1.25) (push) Skipped
Tests / Test (Go stable) (push) Skipped
Tests / Test (Go stable) (pull_request) Failing after 4s
Tests / Secret scan (gitleaks) (pull_request) Successful in 4s
Tests / Test (Go 1.25) (pull_request) Successful in 19s
This commit is contained in:
@@ -250,6 +250,36 @@ func TestFileClientMySQLStoreIsPreferredForReads(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestFileClientWriteToReadOnlyStore guarantees the facade surfaces ErrReadOnly
|
||||
// when the configured write backend is the read-only SQL store.
|
||||
func TestFileClientWriteToReadOnlyStore(t *testing.T) {
|
||||
pg := &pgStore{driver: ProviderPG}
|
||||
f := newFacadeTestClient(
|
||||
map[string]FileStore{ProviderREST: &fakeStore{name: ProviderREST}, ProviderPG: pg},
|
||||
[]string{ProviderPG, ProviderREST},
|
||||
[]string{ProviderPG, ProviderREST},
|
||||
)
|
||||
ctx := context.Background()
|
||||
if _, err := f.CreateFolder(ctx, "1", "x"); !errors.Is(err, ErrReadOnly) {
|
||||
t.Errorf("CreateFolder err = %v", err)
|
||||
}
|
||||
if _, err := f.Upload(ctx, "1", "x", strings.NewReader("x")); !errors.Is(err, ErrReadOnly) {
|
||||
t.Errorf("Upload err = %v", err)
|
||||
}
|
||||
if err := f.Move(ctx, []string{"1"}, "2"); !errors.Is(err, ErrReadOnly) {
|
||||
t.Errorf("Move err = %v", err)
|
||||
}
|
||||
if err := f.Copy(ctx, []string{"1"}, "2"); !errors.Is(err, ErrReadOnly) {
|
||||
t.Errorf("Copy err = %v", err)
|
||||
}
|
||||
if err := f.Rename(ctx, "1", "x"); !errors.Is(err, ErrReadOnly) {
|
||||
t.Errorf("Rename err = %v", err)
|
||||
}
|
||||
if err := f.Delete(ctx, []string{"1"}); !errors.Is(err, ErrReadOnly) {
|
||||
t.Errorf("Delete err = %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFileClientSearchSelection(t *testing.T) {
|
||||
f := &FileClient{searchers: map[string]Searcher{}, searchOrder: []string{ProviderES}}
|
||||
_, err := f.Search()
|
||||
|
||||
Reference in New Issue
Block a user