Skip to content

Commit

Permalink
cleaned tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wonwuakpa-msft committed Dec 3, 2024
1 parent 46c9181 commit 6cf3fec
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 46 deletions.
2 changes: 1 addition & 1 deletion cmd/zc_traverser_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (t *fileTraverser) getPropertiesIfSingleFile() (*file.GetPropertiesResponse
func (t *fileTraverser) Traverse(preprocessor objectMorpher, processor objectProcessor, filters []ObjectFilter) (err error) {
invalidBlobOrWindowsName := func(path string) bool {
if t.destination != nil {
if t.trailingDot == common.ETrailingDotOption.AllowToUnsafeDestination() && runtime.GOOS == "windows" { // Allow only Local, Trailing dot files not supported in Blob
if t.trailingDot == common.ETrailingDotOption.AllowToUnsafeDestination() && (*t.destination != common.ELocation.Blob() || *t.destination != common.ELocation.BlobFS()) { // Allow only Local, Trailing dot files not supported in Blob
return false // Please let me shoot myself in the foot!
}

Expand Down
45 changes: 0 additions & 45 deletions e2etest/zt_newe2e_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,51 +512,6 @@ func (s *FileTestSuite) Scenario_SeveralFileDownloadWildcard(svm *ScenarioVariat
}, true)
}

// 0 transfers of trailing dot files should occur
func (s *FileTestSuite) Scenario_FileDownloadTrailingDotDisable(svm *ScenarioVariationManager) {
size := common.KiloByte
// File names to test
fileNameWithDot := "file."
fileNameWithoutDot := "test"

// Create the content for the files
bodyWithDot := NewRandomObjectContentContainer(int64(size))
bodyWithoutDot := NewRandomObjectContentContainer(int64(size))

// Create the source container and objects
srcContainer := CreateResource[ContainerResourceManager](svm, GetRootResource(svm, common.ELocation.File()), ResourceDefinitionContainer{})
srcObjWithDot := srcContainer.GetObject(svm, fileNameWithDot, common.EEntityType.File())
srcObjWithoutDot := srcContainer.GetObject(svm, fileNameWithoutDot, common.EEntityType.File())
srcObjWithDot.Create(svm, bodyWithDot, ObjectProperties{})
srcObjWithoutDot.Create(svm, bodyWithoutDot, ObjectProperties{})

// Create the destination container
dstContainer := CreateResource[ContainerResourceManager](svm, GetRootResource(svm, common.ELocation.Local()), ResourceDefinitionContainer{})

// Run AzCopy Copy cmd to download the files
RunAzCopy(svm, AzCopyCommand{
Verb: AzCopyVerbCopy,
Targets: []ResourceManager{TryApplySpecificAuthType(srcContainer, EExplicitCredentialType.SASToken(), svm), dstContainer},
Flags: CopyFlags{
CopySyncCommonFlags: CopySyncCommonFlags{
BlockSizeMB: pointerTo(4.0),
TrailingDot: to.Ptr(common.ETrailingDotOption.Disable()), // Only include files without trailing dot
Recursive: pointerTo(true),
},
},
})

// Validate that only the file without the trailing dot is downloaded
ValidateResource[ObjectResourceManager](svm, dstContainer.GetObject(svm, fileNameWithoutDot, common.EEntityType.File()), ResourceDefinitionObject{
Body: bodyWithoutDot,
}, false)

// Validate that the file with the trailing dot is not downloaded
ValidateResource[ObjectResourceManager](svm, dstContainer.GetObject(svm, fileNameWithDot, common.EEntityType.File()), ResourceDefinitionObject{
Body: nil,
}, false)
}

// Test copy with AllowToUnsafeDestination option
func (s *FileTestSuite) Scenario_CopyTrailingDotUnsafeDestination(svm *ScenarioVariationManager) {
body := NewRandomObjectContentContainer(0)
Expand Down

0 comments on commit 6cf3fec

Please sign in to comment.