github.com/artpar/rclone@v1.67.3/backend/compress/compress_test.go (about)

     1  // Test Crypt filesystem interface
     2  package compress
     3  
     4  import (
     5  	"os"
     6  	"path/filepath"
     7  	"testing"
     8  
     9  	_ "github.com/artpar/rclone/backend/drive"
    10  	_ "github.com/artpar/rclone/backend/local"
    11  	_ "github.com/artpar/rclone/backend/s3"
    12  	_ "github.com/artpar/rclone/backend/swift"
    13  	"github.com/artpar/rclone/fstest"
    14  	"github.com/artpar/rclone/fstest/fstests"
    15  )
    16  
    17  var defaultOpt = fstests.Opt{
    18  	RemoteName: "TestCompress:",
    19  	NilObject:  (*Object)(nil),
    20  	UnimplementableFsMethods: []string{
    21  		"OpenWriterAt",
    22  		"OpenChunkWriter",
    23  		"MergeDirs",
    24  		"DirCacheFlush",
    25  		"PutUnchecked",
    26  		"PutStream",
    27  		"UserInfo",
    28  		"Disconnect",
    29  	},
    30  	TiersToTest:                  []string{"STANDARD", "STANDARD_IA"},
    31  	UnimplementableObjectMethods: []string{},
    32  }
    33  
    34  // TestIntegration runs integration tests against the remote
    35  func TestIntegration(t *testing.T) {
    36  	fstests.Run(t, &defaultOpt)
    37  }
    38  
    39  // TestRemoteGzip tests GZIP compression
    40  func TestRemoteGzip(t *testing.T) {
    41  	if *fstest.RemoteName != "" {
    42  		t.Skip("Skipping as -remote set")
    43  	}
    44  	tempdir := filepath.Join(os.TempDir(), "rclone-compress-test-gzip")
    45  	name := "TestCompressGzip"
    46  	opt := defaultOpt
    47  	opt.RemoteName = name + ":"
    48  	opt.ExtraConfig = []fstests.ExtraConfigItem{
    49  		{Name: name, Key: "type", Value: "compress"},
    50  		{Name: name, Key: "remote", Value: tempdir},
    51  		{Name: name, Key: "compression_mode", Value: "gzip"},
    52  	}
    53  	opt.QuickTestOK = true
    54  	fstests.Run(t, &opt)
    55  }