func (s *cmdIntegrationSuite) TestSyncS2SBetweenVirtualDirs(c *chk.C) {
	bsu := getBSU()
	srcContainerURL, srcContainerName := createNewContainer(c, bsu)
	dstContainerURL, dstContainerName := createNewContainer(c, bsu)
	defer deleteContainer(c, srcContainerURL)
	defer deleteContainer(c, dstContainerURL)

	// set up the source container with numerous blobs
	vdirName := "vdir"
	blobList := scenarioHelper{}.generateCommonRemoteScenarioForBlob(c, srcContainerURL, vdirName+common.AZCOPY_PATH_SEPARATOR_STRING)
	c.Assert(len(blobList), chk.Not(chk.Equals), 0)

	// set up the destination with the exact same files
	scenarioHelper{}.generateBlobsFromList(c, dstContainerURL, blobList, blockBlobDefaultData)

	// set up interceptor
	mockedRPC := interceptor{}
	Rpc = mockedRPC.intercept
	mockedRPC.init()

	// construct the raw input to simulate user input
	srcContainerURLWithSAS := scenarioHelper{}.getRawContainerURLWithSAS(c, srcContainerName)
	dstContainerURLWithSAS := scenarioHelper{}.getRawContainerURLWithSAS(c, dstContainerName)
	srcContainerURLWithSAS.Path += common.AZCOPY_PATH_SEPARATOR_STRING + vdirName
	dstContainerURLWithSAS.Path += common.AZCOPY_PATH_SEPARATOR_STRING + vdirName
	raw := getDefaultSyncRawInput(srcContainerURLWithSAS.String(), dstContainerURLWithSAS.String())

	// nothing should be synced since the source is older
	runSyncAndVerify(c, raw, func(err error) {
		c.Assert(err, chk.IsNil)

		// validate that the right number of transfers were scheduled
		c.Assert(len(mockedRPC.transfers), chk.Equals, 0)
	})

	// refresh the blobs' last modified time so that they are newer
	scenarioHelper{}.generateBlobsFromList(c, srcContainerURL, blobList, blockBlobDefaultData)
	mockedRPC.reset()
	expectedList := scenarioHelper{}.shaveOffPrefix(blobList, vdirName+common.AZCOPY_PATH_SEPARATOR_STRING)
	runSyncAndVerify(c, raw, func(err error) {
		c.Assert(err, chk.IsNil)
		validateS2SSyncTransfersAreScheduled(c, "", "", expectedList, mockedRPC)
	})
}
// regular vdir -> vdir sync
regular vdir -> vdir sync
// regular vdir - > vdir sync
func (s *cmdIntegrationSuite) TestSyncS2SBetweenVirtualDirs(c *chk.C) {
	bsu := getBSU()
	srcContainerURL, srcContainerName := createNewContainer(c, bsu)
	dstContainerURL, dstContainerName := createNewContainer(c, bsu)
	defer deleteContainer(c, srcContainerURL)
	defer deleteContainer(c, dstContainerURL)
	vdirName := "vdir"
	blobList := scenarioHelper{}.generateCommonRemoteScenarioForBlob(c, srcContainerURL, vdirName+common.AZCOPY_PATH_SEPARATOR_STRING)
	c.Assert(len(blobList), chk.Not(chk.Equals), 0)
	scenarioHelper{}.generateBlobsFromList(c, dstContainerURL, blobList, blockBlobDefaultData)
	mockedRPC := interceptor{}
	Rpc = mockedRPC.intercept
	mockedRPC.init()
	srcContainerURLWithSAS := scenarioHelper{}.getRawContainerURLWithSAS(c, srcContainerName)
	dstContainerURLWithSAS := scenarioHelper{}.getRawContainerURLWithSAS(c, dstContainerName)
	srcContainerURLWithSAS.Path += common.AZCOPY_PATH_SEPARATOR_STRING + vdirName
	dstContainerURLWithSAS.Path += common.AZCOPY_PATH_SEPARATOR_STRING + vdirName
	raw := getDefaultSyncRawInput(srcContainerURLWithSAS.String(), dstContainerURLWithSAS.String())
	runSyncAndVerify(c, raw, func(err error) {
		c.Assert(err, chk.IsNil)
		c.Assert(len(mockedRPC.transfers), chk.Equals, 0)
	})
	scenarioHelper{}.generateBlobsFromList(c, srcContainerURL, blobList, blockBlobDefaultData)
	mockedRPC.reset()
	expectedList := scenarioHelper{}.shaveOffPrefix(blobList, vdirName+common.AZCOPY_PATH_SEPARATOR_STRING)
	runSyncAndVerify(c, raw, func(err error) {
		c.Assert(err, chk.IsNil)
		validateS2SSyncTransfersAreScheduled(c, "", "", expectedList, mockedRPC)
	})
}
func ( s * cmdIntegrationSuite ) TestSyncS2SBetweenVirtualDirs ( c * chk . C ) { bsu := getBSU ( ) srcContainerURL , srcContainerName := createNewContainer ( c , bsu ) dstContainerURL , dstContainerName := createNewContainer ( c , bsu ) defer deleteContainer ( c , srcContainerURL ) defer deleteContainer ( c , dstContainerURL ) vdirName := " " blobList := scenarioHelper { } . generateCommonRemoteScenarioForBlob ( c , srcContainerURL , vdirName + common . AZCOPY_PATH_SEPARATOR_STRING ) c . Assert ( len ( blobList ) , chk . Not ( chk . Equals ) , 0 ) scenarioHelper { } . generateBlobsFromList ( c , dstContainerURL , blobList , blockBlobDefaultData ) mockedRPC := interceptor { } Rpc = mockedRPC . intercept mockedRPC . init ( ) srcContainerURLWithSAS := scenarioHelper { } . getRawContainerURLWithSAS ( c , srcContainerName ) dstContainerURLWithSAS := scenarioHelper { } . getRawContainerURLWithSAS ( c , dstContainerName ) srcContainerURLWithSAS . Path += common . AZCOPY_PATH_SEPARATOR_STRING + vdirName dstContainerURLWithSAS . Path += common . AZCOPY_PATH_SEPARATOR_STRING + vdirName raw := getDefaultSyncRawInput ( srcContainerURLWithSAS . String ( ) , dstContainerURLWithSAS . String ( ) ) runSyncAndVerify ( c , raw , func ( err error ) { c . Assert ( err , chk . IsNil ) c . Assert ( len ( mockedRPC . transfers ) , chk . Equals , 0 ) } ) scenarioHelper { } . generateBlobsFromList ( c , srcContainerURL , blobList , blockBlobDefaultData ) mockedRPC . reset ( ) expectedList := scenarioHelper { } . shaveOffPrefix ( blobList , vdirName + common . AZCOPY_PATH_SEPARATOR_STRING ) runSyncAndVerify ( c , raw , func ( err error ) { c . Assert ( err , chk . IsNil ) validateS2SSyncTransfersAreScheduled ( c , " " , " " , expectedList , mockedRPC ) } ) }
regular vdir -> vdir sync
regular vdir - > vdir sync
// set up the source container with numerous blobs // set up the destination with the exact same files // set up interceptor // construct the raw input to simulate user input // nothing should be synced since the source is older // validate that the right number of transfers were scheduled // refresh the blobs' last modified time so that they are newer