You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
841 B

  1. package filer
  2. import (
  3. "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
  4. "github.com/stretchr/testify/assert"
  5. "testing"
  6. )
  7. func TestFilerRemoteStorage_FindRemoteStorageClient(t *testing.T) {
  8. conf := &filer_pb.RemoteConf{
  9. Name: "s7",
  10. Type: "s3",
  11. }
  12. rs := NewFilerRemoteStorage()
  13. rs.storageNameToConf[conf.Name] = conf
  14. rs.mapDirectoryToRemoteStorage("/a/b/c", "s7")
  15. _, found := rs.FindRemoteStorageClient("/a/b/c/d/e/f")
  16. assert.Equal(t, true, found, "find storage client")
  17. _, found2 := rs.FindRemoteStorageClient("/a/b")
  18. assert.Equal(t, false, found2, "should not find storage client")
  19. _, found3 := rs.FindRemoteStorageClient("/a/b/c")
  20. assert.Equal(t, false, found3, "should not find storage client")
  21. _, found4 := rs.FindRemoteStorageClient("/a/b/cc")
  22. assert.Equal(t, false, found4, "should not find storage client")
  23. }