2017-07-25 14:18:13 +00:00
|
|
|
// Test AzureBlob filesystem interface
|
2018-07-13 15:21:49 +00:00
|
|
|
|
2023-06-23 08:50:01 +00:00
|
|
|
//go:build !plan9 && !solaris && !js
|
2018-07-13 15:21:49 +00:00
|
|
|
|
2018-09-07 11:02:27 +00:00
|
|
|
package azureblob
|
2017-07-25 14:18:13 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2019-07-28 17:47:38 +00:00
|
|
|
"github.com/rclone/rclone/fs"
|
2023-04-28 16:24:19 +00:00
|
|
|
"github.com/rclone/rclone/fstest"
|
2019-07-28 17:47:38 +00:00
|
|
|
"github.com/rclone/rclone/fstest/fstests"
|
2020-12-06 05:13:51 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
2017-07-25 14:18:13 +00:00
|
|
|
)
|
|
|
|
|
2018-04-07 17:48:11 +00:00
|
|
|
// TestIntegration runs integration tests against the remote
|
|
|
|
func TestIntegration(t *testing.T) {
|
|
|
|
fstests.Run(t, &fstests.Opt{
|
2022-11-23 16:46:21 +00:00
|
|
|
RemoteName: "TestAzureBlob:",
|
|
|
|
NilObject: (*Object)(nil),
|
2023-10-18 07:01:11 +00:00
|
|
|
TiersToTest: []string{"Hot", "Cool", "Cold"},
|
2022-11-23 16:46:21 +00:00
|
|
|
ChunkedUpload: fstests.ChunkedUploadConfig{
|
|
|
|
MinChunkSize: defaultChunkSize,
|
|
|
|
},
|
2018-04-07 17:48:11 +00:00
|
|
|
})
|
2017-07-25 14:18:13 +00:00
|
|
|
}
|
2018-09-07 11:02:27 +00:00
|
|
|
|
2023-04-28 16:24:19 +00:00
|
|
|
// TestIntegration2 runs integration tests against the remote
|
|
|
|
func TestIntegration2(t *testing.T) {
|
|
|
|
if *fstest.RemoteName != "" {
|
|
|
|
t.Skip("Skipping as -remote set")
|
|
|
|
}
|
2023-09-03 17:09:31 +00:00
|
|
|
name := "TestAzureBlob"
|
2023-04-28 16:24:19 +00:00
|
|
|
fstests.Run(t, &fstests.Opt{
|
2023-09-03 17:09:31 +00:00
|
|
|
RemoteName: name + ":",
|
2023-04-28 16:24:19 +00:00
|
|
|
NilObject: (*Object)(nil),
|
2023-10-18 07:01:11 +00:00
|
|
|
TiersToTest: []string{"Hot", "Cool", "Cold"},
|
2023-04-28 16:24:19 +00:00
|
|
|
ChunkedUpload: fstests.ChunkedUploadConfig{
|
|
|
|
MinChunkSize: defaultChunkSize,
|
|
|
|
},
|
|
|
|
ExtraConfig: []fstests.ExtraConfigItem{
|
|
|
|
{Name: name, Key: "directory_markers", Value: "true"},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2018-09-07 11:02:27 +00:00
|
|
|
func (f *Fs) SetUploadChunkSize(cs fs.SizeSuffix) (fs.SizeSuffix, error) {
|
|
|
|
return f.setUploadChunkSize(cs)
|
|
|
|
}
|
|
|
|
|
2018-10-13 21:45:17 +00:00
|
|
|
var (
|
|
|
|
_ fstests.SetUploadChunkSizer = (*Fs)(nil)
|
|
|
|
)
|
2020-12-06 05:13:51 +00:00
|
|
|
|
2022-05-21 18:36:18 +00: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},
|
2023-10-18 07:01:11 +00:00
|
|
|
"cold": {"cold", true},
|
2022-05-21 18:36:18 +00:00
|
|
|
"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)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|