Replace tests
Examples of commands are given, though not all of them can be used exactly, since the checksums will change from test to test.
Succes scenarios
Basic replace
- Upload a new file with a unique name for this test.
bash bin/bitmag.sh put-file -c integrationtest2 -f conf/logback.xml -i replace_test_1_2022.xml
- Replace the file at a pillar. The file should exist in the collection, providing the correct checksum for the existing file.
- First retrieve the checksum with GetChecksum (or just use md5sum on the local file):
bash bin/bitmag.sh get-checksums -c integrationtest2 -i replace_test_1_2022.xml
Count: Checksum: Pillars: FileID:
5 3228f1d3684c39ed782af5f9e6aee1b0 All replace_test_1_2022.xml
- Use the checksum to replace the file:
bash bin/bitmag.sh replace-file -c integrationtest2 -i replace_test_1_2022.xml -f conf/RepositorySettings.xml -C 3228f1d3684c39ed782af5f9e6aee1b0 -p sbtape2
- First retrieve the checksum with GetChecksum (or just use md5sum on the local file):
- Verify that the file has a different checksum at one pillar, and that the pillars does not agree upon the checksum any more:
bash bin/bitmag.sh get-checksums -c integrationtest2 -i replace_test_1_2022.xml
Count: Checksum: Pillars: FileID:
4 3228f1d3684c39ed782af5f9e6aee1b0 [kbpillar2, reference2, checksum2, sbdisk1] replace_test_1_2022.xml
1 001a83061e71a22a3ac08759fcc082c9 [sbtape2] replace_test_1_2022.xml
Replace with returned checksums
- Upload a new file with a unique id for this test.
bash bin/bitmag.sh put-file -c integrationtest2 -f conf/ReferenceSettings.xml -i replace_test_2_2022.xml
- Replace a file with including the a request of a salted checksum calculated on the pillars, which should be returned.
- First retrieve the salted checksum for the file at all pillars:
bash bin/bitmag.sh get-checksums -c integrationtest2 -i replace_test_2_2022.xml -R HMAC_SHA1 -S abab
Count: Checksum: Pillars: FileID:
4 15abc6f0098da5317ea58e6b850355d760790174 All replace_test_2_2022.xml
- Replace the file and request the salted checksum:
bash bin/bitmag.sh replace-file -c integrationtest2 -i replace_test_2_2022.xml -f conf/RepositorySettings.xml -C 41e3d98b0e97f52f94fba6add86ce7db -p sbtape2 -R HMAC_SHA1 -S abab
PillarId results
sbtape2 : Checksum for replaced file: 15abc6f0098da5317ea58e6b850355d760790174 Checksum for new file: f8fd8422ab0581a37382d2edb01533399c241f3d
- Check that the file is replaced correctly, and that the returned checksums are correct and consistent across the responses returned by the pillars).
bash bin/bitmag.sh get-checksums -c integrationtest2 -i replace_test_2_2022.xml -R HMAC_SHA1 -S abab
Count: Checksum: Pillars: FileID:
3 15abc6f0098da5317ea58e6b850355d760790174 [kbpillar2, reference2, sbdisk1] replace_test_2_2022.xml
1 f8fd8422ab0581a37382d2edb01533399c241f3d [sbtape2] replace_test_2_2022.xml
- First retrieve the salted checksum for the file at all pillars:
Replace with a URL instead of a local file
- Upload a new file with a unique id for this test, and get the checksum for the file
bash bin/bitmag.sh put-file -c integrationtest2 -f bin/massupload.sh -i replace_test_3_2022.xml
md5sum bin/massupload.sh
598c634a8d589b44339cdbffcad1ad44 bin/massupload.sh
- Upload a file to the dav-server (or find a file on the dav-server), and retrieve its checksum
wget sandkasse-01.kb.dk/dav/test.txt
md5sum test.txt
d41d8cd98f00b204e9800998ecf8427e test.txt
- Replace the file with the URL:
bash bin/bitmag.sh replace-file -c integrationtest2 -i replace_test_3_2022.xml -u http://sandkasse-01.kb.dk/dav/test.txt -r d41d8cd98f00b204e9800998ecf8427e -C 598c634a8d589b44339cdbffcad1ad44 -p sbtape2
- Validate that it has been changed:
bash bin/bitmag.sh get-checksums -c integrationtest2 -i replace_test_3_2022.xml
Count: Checksum: Pillars: FileID:
1 d41d8cd98f00b204e9800998ecf8427e [sbtape2] replace_test_3_2022.xml
4 598c634a8d589b44339cdbffcad1ad44 [kbpillar2, reference2, checksum2, sbdisk1] replace_test_3_2022.xml
Failure scenarios
Bad old file checksum
- Attempt to replace a file, providing the wrong checksum for the old file.
- The file shouldn't be replaced, and the user should be informed that the operation failed due to the invalid checksum for the old file.
bash bin/bitmag.sh replace-file -c integrationtest2 -i replace_test_1_2022.xml -f conf/RepositorySettings.xml -C 3228f1d3684c39ed782af5f9e6aee1b1 -p reference2
- The file shouldn't be replaced, and the user should be informed that the operation failed due to the invalid checksum for the old file.
Missing file replace
- Attempt to replace a file that does not exist in the collection.
- The user should be informed that the operation failed because the file did't exist.
bash bin/bitmag.sh replace-file -c integrationtest2 -i replace_test_NON_EXISTING_FILE.xml -f conf/RepositorySettings.xml -C 3228f1d3684c39ed782af5f9e6aee1b1 -p reference2
- The user should be informed that the operation failed because the file did't exist.
Open issues