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.
		
		
		
		
		
			
		
			
				
					
					
						
							34 lines
						
					
					
						
							940 B
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							34 lines
						
					
					
						
							940 B
						
					
					
				
								package filer
							 | 
						|
								
							 | 
						|
								import (
							 | 
						|
									"github.com/seaweedfs/seaweedfs/weed/pb/remote_pb"
							 | 
						|
									"github.com/stretchr/testify/assert"
							 | 
						|
									"testing"
							 | 
						|
								)
							 | 
						|
								
							 | 
						|
								func TestFilerRemoteStorage_FindRemoteStorageClient(t *testing.T) {
							 | 
						|
									conf := &remote_pb.RemoteConf{
							 | 
						|
										Name: "s7",
							 | 
						|
										Type: "s3",
							 | 
						|
									}
							 | 
						|
									rs := NewFilerRemoteStorage()
							 | 
						|
									rs.storageNameToConf[conf.Name] = conf
							 | 
						|
								
							 | 
						|
									rs.mapDirectoryToRemoteStorage("/a/b/c", &remote_pb.RemoteStorageLocation{
							 | 
						|
										Name:   "s7",
							 | 
						|
										Bucket: "some",
							 | 
						|
										Path:   "/dir",
							 | 
						|
									})
							 | 
						|
								
							 | 
						|
									_, _, found := rs.FindRemoteStorageClient("/a/b/c/d/e/f")
							 | 
						|
									assert.Equal(t, true, found, "find storage client")
							 | 
						|
								
							 | 
						|
									_, _, found2 := rs.FindRemoteStorageClient("/a/b")
							 | 
						|
									assert.Equal(t, false, found2, "should not find storage client")
							 | 
						|
								
							 | 
						|
									_, _, found3 := rs.FindRemoteStorageClient("/a/b/c")
							 | 
						|
									assert.Equal(t, false, found3, "should not find storage client")
							 | 
						|
								
							 | 
						|
									_, _, found4 := rs.FindRemoteStorageClient("/a/b/cc")
							 | 
						|
									assert.Equal(t, false, found4, "should not find storage client")
							 | 
						|
								}
							 |