2017-07-25 22:18:13 +08:00
|
|
|
// Test AzureBlob filesystem interface
|
2018-07-13 23:21:49 +08:00
|
|
|
|
2022-11-24 00:46:21 +08:00
|
|
|
//go:build !plan9 && !solaris && !js && go1.18
|
|
|
|
// +build !plan9,!solaris,!js,go1.18
|
2018-07-13 23:21:49 +08:00
|
|
|
|
2018-09-07 19:02:27 +08:00
|
|
|
package azureblob
|
2017-07-25 22:18:13 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2019-07-29 01:47:38 +08:00
|
|
|
"github.com/rclone/rclone/fs"
|
|
|
|
"github.com/rclone/rclone/fstest/fstests"
|
2020-12-06 13:13:51 +08:00
|
|
|
"github.com/stretchr/testify/assert"
|
2017-07-25 22:18:13 +08:00
|
|
|
)
|
|
|
|
|
2018-04-08 01:48:11 +08:00
|
|
|
// TestIntegration runs integration tests against the remote
|
|
|
|
func TestIntegration(t *testing.T) {
|
|
|
|
fstests.Run(t, &fstests.Opt{
|
2022-11-24 00:46:21 +08:00
|
|
|
RemoteName: "TestAzureBlob:",
|
|
|
|
NilObject: (*Object)(nil),
|
|
|
|
TiersToTest: []string{"Hot", "Cool"},
|
|
|
|
ChunkedUpload: fstests.ChunkedUploadConfig{
|
|
|
|
MinChunkSize: defaultChunkSize,
|
|
|
|
},
|
2018-04-08 01:48:11 +08:00
|
|
|
})
|
2017-07-25 22:18:13 +08:00
|
|
|
}
|
2018-09-07 19:02:27 +08:00
|
|
|
|
|
|
|
func (f *Fs) SetUploadChunkSize(cs fs.SizeSuffix) (fs.SizeSuffix, error) {
|
|
|
|
return f.setUploadChunkSize(cs)
|
|
|
|
}
|
|
|
|
|
2018-10-14 05:45:17 +08:00
|
|
|
var (
|
|
|
|
_ fstests.SetUploadChunkSizer = (*Fs)(nil)
|
|
|
|
)
|
2020-12-06 13:13:51 +08:00
|
|
|
|
2022-05-22 02:36:18 +08:00
|
|
|
func TestValidateAccessTier(t *testing.T) {
|
|
|
|
tests := map[string]struct {
|
|
|
|
accessTier string
|
|
|
|
want bool
|
|
|
|
}{
|
|
|
|
"hot": {"hot", true},
|
|
|
|
"HOT": {"HOT", true},
|
|
|
|
"Hot": {"Hot", true},
|
|
|
|
"cool": {"cool", true},
|
|
|
|
"archive": {"archive", true},
|
|
|
|
"empty": {"", false},
|
|
|
|
"unknown": {"unknown", false},
|
|
|
|
}
|
|
|
|
|
|
|
|
for name, test := range tests {
|
|
|
|
t.Run(name, func(t *testing.T) {
|
|
|
|
got := validateAccessTier(test.accessTier)
|
|
|
|
assert.Equal(t, test.want, got)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|