mirror of
https://github.com/jkl1337/duplicacy.git
synced 2026-01-02 03:34:39 -06:00
Fixed #76: must create a new chunk for uploading in the copy operation
This commit is contained in:
@@ -13,5 +13,5 @@ add_file file4
|
||||
backup
|
||||
add_file file5
|
||||
restore
|
||||
|
||||
check
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ TEST_REPO=$TEST_ZONE/TEST_REPO
|
||||
# Storage for test ( For now, only local path storage is supported by test suite)
|
||||
TEST_STORAGE=$TEST_ZONE/TEST_STORAGE
|
||||
|
||||
# Extra storage for copy operation
|
||||
SECONDARY_STORAGE=$TEST_ZONE/SECONDARY_STORAGE
|
||||
|
||||
# Preference directory ( for testing the -pref-dir option)
|
||||
DUPLICACY_PREF_DIR=$TEST_ZONE/TEST_DUPLICACY_PREF_DIR
|
||||
|
||||
@@ -46,6 +49,11 @@ function fixture()
|
||||
rm -rf $TEST_STORAGE
|
||||
mkdir -p $TEST_STORAGE
|
||||
|
||||
# clean SECONDARY_STORAGE
|
||||
rm -rf $SECONDARY_STORAGE
|
||||
mkdir -p $SECONDARY_STORAGE
|
||||
|
||||
|
||||
# clean TEST_DOT_DUPLICACY
|
||||
rm -rf $DUPLICACY_PREF_DIR
|
||||
mkdir -p $DUPLICACY_PREF_DIR
|
||||
@@ -64,6 +72,7 @@ function init_repo()
|
||||
{
|
||||
pushd ${TEST_REPO}
|
||||
${DUPLICACY} init integration-tests $TEST_STORAGE
|
||||
${DUPLICACY} add -copy default secondary integration-tests $SECONDARY_STORAGE
|
||||
${DUPLICACY} backup
|
||||
popd
|
||||
|
||||
@@ -73,6 +82,7 @@ function init_repo_pref_dir()
|
||||
{
|
||||
pushd ${TEST_REPO}
|
||||
${DUPLICACY} init -pref-dir "${DUPLICACY_PREF_DIR}" integration-tests ${TEST_STORAGE}
|
||||
${DUPLICACY} add -copy default secondary integration-tests $SECONDARY_STORAGE
|
||||
${DUPLICACY} backup
|
||||
popd
|
||||
|
||||
@@ -82,6 +92,7 @@ function add_file()
|
||||
{
|
||||
FILE_NAME=$1
|
||||
pushd ${TEST_REPO}
|
||||
dd if=/dev/urandom of=${FILE_NAME} bs=1000 count=20000
|
||||
echo ${FILE_NAME} > "${FILE_NAME}"
|
||||
popd
|
||||
}
|
||||
@@ -91,6 +102,7 @@ function backup()
|
||||
{
|
||||
pushd ${TEST_REPO}
|
||||
${DUPLICACY} backup
|
||||
${DUPLICACY} copy -from default -to secondary
|
||||
popd
|
||||
}
|
||||
|
||||
@@ -100,4 +112,12 @@ function restore()
|
||||
pushd ${TEST_REPO}
|
||||
${DUPLICACY} restore -r 2 -delete
|
||||
popd
|
||||
}
|
||||
}
|
||||
|
||||
function check()
|
||||
{
|
||||
pushd ${TEST_REPO}
|
||||
${DUPLICACY} check -files
|
||||
${DUPLICACY} check -storage secondary -files
|
||||
popd
|
||||
}
|
||||
|
||||
@@ -1337,6 +1337,7 @@ func (manager *BackupManager) CopySnapshots(otherManager *BackupManager, snapsho
|
||||
} else {
|
||||
LOG_INFO("SNAPSHOT_COPY", "Copied chunk %s (%d/%d)", chunk.GetID(), chunkIndex, len(chunks))
|
||||
}
|
||||
otherManager.config.PutChunk(chunk)
|
||||
})
|
||||
chunkUploader.Start()
|
||||
|
||||
@@ -1350,7 +1351,10 @@ func (manager *BackupManager) CopySnapshots(otherManager *BackupManager, snapsho
|
||||
|
||||
i := chunkDownloader.AddChunk(chunkHash)
|
||||
chunk := chunkDownloader.WaitForChunk(i)
|
||||
chunkUploader.StartChunk(chunk, chunkIndex)
|
||||
newChunk := otherManager.config.GetChunk()
|
||||
newChunk.Reset(true)
|
||||
newChunk.Write(chunk.GetBytes())
|
||||
chunkUploader.StartChunk(newChunk, chunkIndex)
|
||||
}
|
||||
|
||||
chunkDownloader.Stop()
|
||||
|
||||
Reference in New Issue
Block a user