Browse Source
feat: add statfile remote storage (#8443)
feat: add statfile remote storage (#8443)
* feat: add statfile; add error for remote storage misses * feat: statfile implementations for storage providers * test: add unit tests for StatFile method across providers Add comprehensive unit tests for the StatFile implementation covering: - S3: interface compliance and error constant accessibility - Azure: interface compliance, error constants, and field population - GCS: interface compliance, error constants, error detection, and field population Also fix variable shadowing issue in S3 and Azure StatFile implementations where named return parameters were being shadowed by local variable declarations. Co-authored-by: Cursor <cursoragent@cursor.com> * fix: address StatFile review feedback - Use errors.New for ErrRemoteObjectNotFound sentinel - Fix S3 HeadObject 404 detection to use awserr.Error code check - Remove hollow field-population tests that tested nothing - Remove redundant stdlib error detection tests - Trim verbose doc comment on ErrRemoteObjectNotFound Co-authored-by: Cursor <cursoragent@cursor.com> * fix: address second round of StatFile review feedback - Rename interface assertion tests to TestXxxRemoteStorageClientImplementsInterface - Delegate readFileRemoteEntry to StatFile in all three providers - Revert S3 404 detection to RequestFailure.StatusCode() check - Fix double-slash in GCS error message format string - Add storage type prefix to S3 error message for consistency Co-authored-by: Cursor <cursoragent@cursor.com> * fix: comments --------- Co-authored-by: Cursor <cursoragent@cursor.com>expand-the-s3-PutObject-permission-to-the-multipart-permissions
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 126 additions and 55 deletions
-
53weed/remote_storage/azure/azure_storage_client.go
-
12weed/remote_storage/azure/azure_storage_client_test.go
-
39weed/remote_storage/gcs/gcs_storage_client.go
-
17weed/remote_storage/gcs/gcs_storage_client_test.go
-
5weed/remote_storage/remote_storage.go
-
45weed/remote_storage/s3/s3_storage_client.go
-
10weed/remote_storage/s3/s3_storage_client_test.go
@ -0,0 +1,17 @@ |
|||||
|
package gcs |
||||
|
|
||||
|
import ( |
||||
|
"testing" |
||||
|
|
||||
|
"github.com/seaweedfs/seaweedfs/weed/remote_storage" |
||||
|
"github.com/stretchr/testify/require" |
||||
|
) |
||||
|
|
||||
|
func TestGCSRemoteStorageClientImplementsInterface(t *testing.T) { |
||||
|
var _ remote_storage.RemoteStorageClient = (*gcsRemoteStorageClient)(nil) |
||||
|
} |
||||
|
|
||||
|
func TestGCSErrRemoteObjectNotFoundIsAccessible(t *testing.T) { |
||||
|
require.Error(t, remote_storage.ErrRemoteObjectNotFound) |
||||
|
require.Equal(t, "remote object not found", remote_storage.ErrRemoteObjectNotFound.Error()) |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue