func (s *cmdIntegrationSuite) TestSyncS2SWithEmptyDestination(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
	blobList := scenarioHelper{}.generateCommonRemoteScenarioForBlob(c, srcContainerURL, "")
	c.Assert(len(blobList), chk.Not(chk.Equals), 0)

	// 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)
	raw := getDefaultSyncRawInput(srcContainerURLWithSAS.String(), dstContainerURLWithSAS.String())

	// all blobs at source should be synced to destination
	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, len(blobList))

		// validate that the right transfers were sent
		validateS2SSyncTransfersAreScheduled(c, "", "", blobList, mockedRPC)
	})

	// turn off recursive, this time only top blobs should be transferred
	raw.recursive = false
	mockedRPC.reset()
	runSyncAndVerify(c, raw, func(err error) {
		c.Assert(err, chk.IsNil)
		c.Assert(len(mockedRPC.transfers), chk.Not(chk.Equals), len(blobList))

		for _, transfer := range mockedRPC.transfers {
			c.Assert(strings.Contains(transfer.Source, common.AZCOPY_PATH_SEPARATOR_STRING), chk.Equals, false)
		}
	})
}
// regular container->container sync but destination is empty, so everything has to be transferred
regular container->container sync but destination is empty, so everything has to be transferred
// regular container - > container sync but destination is empty so everything has to be transferred
func (s *cmdIntegrationSuite) TestSyncS2SWithEmptyDestination(c *chk.C) {
	bsu := getBSU()
	srcContainerURL, srcContainerName := createNewContainer(c, bsu)
	dstContainerURL, dstContainerName := createNewContainer(c, bsu)
	defer deleteContainer(c, srcContainerURL)
	defer deleteContainer(c, dstContainerURL)
	blobList := scenarioHelper{}.generateCommonRemoteScenarioForBlob(c, srcContainerURL, "")
	c.Assert(len(blobList), chk.Not(chk.Equals), 0)
	mockedRPC := interceptor{}
	Rpc = mockedRPC.intercept
	mockedRPC.init()
	srcContainerURLWithSAS := scenarioHelper{}.getRawContainerURLWithSAS(c, srcContainerName)
	dstContainerURLWithSAS := scenarioHelper{}.getRawContainerURLWithSAS(c, dstContainerName)
	raw := getDefaultSyncRawInput(srcContainerURLWithSAS.String(), dstContainerURLWithSAS.String())
	runSyncAndVerify(c, raw, func(err error) {
		c.Assert(err, chk.IsNil)
		c.Assert(len(mockedRPC.transfers), chk.Equals, len(blobList))
		validateS2SSyncTransfersAreScheduled(c, "", "", blobList, mockedRPC)
	})
	raw.recursive = false
	mockedRPC.reset()
	runSyncAndVerify(c, raw, func(err error) {
		c.Assert(err, chk.IsNil)
		c.Assert(len(mockedRPC.transfers), chk.Not(chk.Equals), len(blobList))
		for _, transfer := range mockedRPC.transfers {
			c.Assert(strings.Contains(transfer.Source, common.AZCOPY_PATH_SEPARATOR_STRING), chk.Equals, false)
		}
	})
}
func ( s * cmdIntegrationSuite ) TestSyncS2SWithEmptyDestination ( c * chk . C ) { bsu := getBSU ( ) srcContainerURL , srcContainerName := createNewContainer ( c , bsu ) dstContainerURL , dstContainerName := createNewContainer ( c , bsu ) defer deleteContainer ( c , srcContainerURL ) defer deleteContainer ( c , dstContainerURL ) blobList := scenarioHelper { } . generateCommonRemoteScenarioForBlob ( c , srcContainerURL , " " ) c . Assert ( len ( blobList ) , chk . Not ( chk . Equals ) , 0 ) mockedRPC := interceptor { } Rpc = mockedRPC . intercept mockedRPC . init ( ) srcContainerURLWithSAS := scenarioHelper { } . getRawContainerURLWithSAS ( c , srcContainerName ) dstContainerURLWithSAS := scenarioHelper { } . getRawContainerURLWithSAS ( c , dstContainerName ) raw := getDefaultSyncRawInput ( srcContainerURLWithSAS . String ( ) , dstContainerURLWithSAS . String ( ) ) runSyncAndVerify ( c , raw , func ( err error ) { c . Assert ( err , chk . IsNil ) c . Assert ( len ( mockedRPC . transfers ) , chk . Equals , len ( blobList ) ) validateS2SSyncTransfersAreScheduled ( c , " " , " " , blobList , mockedRPC ) } ) raw . recursive = false mockedRPC . reset ( ) runSyncAndVerify ( c , raw , func ( err error ) { c . Assert ( err , chk . IsNil ) c . Assert ( len ( mockedRPC . transfers ) , chk . Not ( chk . Equals ) , len ( blobList ) ) for _ , transfer := range mockedRPC . transfers { c . Assert ( strings . Contains ( transfer . Source , common . AZCOPY_PATH_SEPARATOR_STRING ) , chk . Equals , false ) } } ) }
regular container->container sync but destination is empty, so everything has to be transferred
regular container - > container sync but destination is empty so everything has to be transferred
// set up the source container with numerous blobs // set up interceptor // construct the raw input to simulate user input // all blobs at source should be synced to destination // validate that the right number of transfers were scheduled // validate that the right transfers were sent // turn off recursive, this time only top blobs should be transferred