Browse Source

rm import rclone and add test action

pull/5443/head
Konstantin Lebedev 1 year ago
parent
commit
66aade24e4
  1. 34
      .github/workflows/s3tests.yml
  2. 6
      weed/operation/upload_content.go

34
.github/workflows/s3tests.yml

@ -34,14 +34,18 @@ jobs:
go-version-file: 'go.mod'
id: go
- name: Build weed
shell: bash
run: |
cd /__w/seaweedfs/seaweedfs/weed
go install -buildvcs=false
- name: Run Ceph S3 tests
timeout-minutes: 15
env:
S3TEST_CONF: /__w/seaweedfs/seaweedfs/docker/compose/s3tests.conf
shell: bash
run: |
cd /__w/seaweedfs/seaweedfs/weed
go install -buildvcs=false
set -x
nohup weed -v 0 server -filer -s3 -ip.bind 0.0.0.0 \
-master.raftHashicorp -master.electionTimeout 1s -master.volumeSizeLimitMB=1024 \
@ -187,3 +191,29 @@ jobs:
s3tests_boto3/functional/test_s3.py::test_ranged_request_return_trailing_bytes_response_code \
s3tests_boto3/functional/test_s3.py::test_copy_object_ifmatch_good \
s3tests_boto3/functional/test_s3.py::test_copy_object_ifnonematch_failed
- uses: actions/checkout@v4
with:
repository: "rclone/rclone"
- name: Run Rclone S3 tests
timeout-minutes: 15
env:
RCLONE_CONFIG_SWFS_TYPE: s3
RCLONE_CONFIG_SWFS_PROVIDER: Other
RCLONE_CONFIG_SWFS_ACCESS_KEY_ID: some_access_key1
RCLONE_CONFIG_SWFS_SECRET_ACCESS_KEY: some_secret_key1
RCLONE_CONFIG_SWFS_ENDPOINT: http://localhost:8000
RCLONE_CONFIG_SWFS_UPLOAD_CUTOFF: 50Mi
RCLONE_CONFIG_SWFS_CHUNK_SIZE: 50Mi
RCLONE_CONFIG_SWFS_FORCE_PATH_STYLE: true
shell: bash
run: |
set -x
nohup weed -v 0 server -filer -s3 -ip.bind 0.0.0.0 \
-master.raftHashicorp -master.electionTimeout 1s -master.volumeSizeLimitMB=1024 \
-volume.max=100 -volume.preStopSeconds=1 -s3.port=8000 -metricsPort=9324 \
-s3.allowEmptyFolder=false -s3.allowDeleteBucketNotEmpty=true -s3.config=../docker/compose/s3.json &
sleep 10
cd /__w/seaweedfs/seaweedfs/rclone/rclone/backend/s3
go test -v -remote swfs:

6
weed/operation/upload_content.go

@ -5,7 +5,6 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/rclone/rclone/lib/encoder"
"io"
"mime"
"mime/multipart"
@ -67,7 +66,8 @@ type HTTPClient interface {
}
var (
HttpClient HTTPClient
HttpClient HTTPClient
fileNameEscaper = strings.NewReplacer(`\`, `\\`, `"`, `\"`)
)
func init() {
@ -278,7 +278,7 @@ func upload_content(fillBufferFunction func(w io.Writer) error, originalDataSize
defer PutBuffer(buf)
body_writer := multipart.NewWriter(buf)
h := make(textproto.MIMEHeader)
filename := encoder.Standard.Encode(option.Filename)
filename := fileNameEscaper.Replace(strings.Trim(option.Filename, "\n\r\t\v"))
h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="file"; filename="%s"`, filename))
h.Set("Idempotency-Key", option.UploadUrl)
if option.MimeType == "" {

Loading…
Cancel
Save