Skip to content

Commit

Permalink
Added E2E test for system container copy scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
dphulkar-msft committed Jan 10, 2025
1 parent 0dcfaf5 commit 5879dd6
Showing 1 changed file with 52 additions and 1 deletion.
53 changes: 52 additions & 1 deletion e2etest/zt_newe2e_s2s_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package e2etest

import (
"strconv"
"time"

"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
"github.com/Azure/azure-storage-azcopy/v10/common"
"strconv"
)

func init() {
Expand Down Expand Up @@ -619,3 +621,52 @@ func (s *S2STestSuite) Scenario_S2SDirectoryMultipleFilesStripTopDirNonRecursive
Objects: dstObjs,
}, true)
}

func (s *S2STestSuite) Scenario_SystemContainerCopy(svm *ScenarioVariationManager) {
azCopyVerb := ResolveVariation(svm, []AzCopyVerb{AzCopyVerbCopy, AzCopyVerbSync}) // Calculate verb early to create the destination object early
// Scale up from service to object
containerName := "$blobchangefeed"
dstObj := CreateResource[ContainerResourceManager](svm, GetRootResource(svm, ResolveVariation(svm, []common.Location{common.ELocation.Blob()})), ResourceDefinitionContainer{
ContainerName: &containerName,
}).GetObject(svm, "test", common.EEntityType.File())

// The object must exist already if we're syncing.
if azCopyVerb == AzCopyVerbSync {
dstObj.Create(svm, NewZeroObjectContentContainer(0), ObjectProperties{})

if !svm.Dryrun() {
// Make sure the LMT is in the past
time.Sleep(time.Second * 10)
}
}

body := NewRandomObjectContentContainer(SizeFromString("10K"))
// Scale up from service to object
srcObj := CreateResource[ObjectResourceManager](svm, GetRootResource(svm, ResolveVariation(svm, []common.Location{common.ELocation.Local(), common.ELocation.Blob(), common.ELocation.File(), common.ELocation.BlobFS()})), ResourceDefinitionObject{
ObjectName: pointerTo("test"),
Body: body,
})

sasOpts := GenericAccountSignatureValues{}

stdOut, _ := RunAzCopy(
svm,
AzCopyCommand{
Verb: azCopyVerb,
Targets: []ResourceManager{
TryApplySpecificAuthType(srcObj, EExplicitCredentialType.SASToken(), svm, CreateAzCopyTargetOptions{
SASTokenOptions: sasOpts,
}),
TryApplySpecificAuthType(dstObj, EExplicitCredentialType.SASToken(), svm, CreateAzCopyTargetOptions{
SASTokenOptions: sasOpts,
}),
},
Flags: CopyFlags{
CopySyncCommonFlags: CopySyncCommonFlags{
Recursive: pointerTo(true),
},
},
ShouldFail: true,
})
ValidateMessageOutput(svm, stdOut, "cannot copy to system container")
}

0 comments on commit 5879dd6

Please sign in to comment.