PutFile tests
The commands presented are just examples of what the actual command to test with could look like.
Note that a jupyter notebook implementing these tests have been attached
Basic put
- Put a file to all pillars
Run put command on a file which is not present in the collection. One can ensure that the file does not exist in the collection by running
"bash bin/bitmag.sh get-file -c integrationtest2 -i logback.xml".
This command should return a response similar to :Failure: c2432066: GET_FILE for file logback.xml: FAILED: , Unable to continue operation, contributors unavailable.
bash bin/bitmag.sh put-file -c integrationtest2 -f conf/logback.xml
- Verify that it is now present at all pillars, and that it has the same checksum at all pillars
bash bin/bitmag.sh get-file-ids -c integrationtest2 -i logback.xml
bash bin/bitmag.sh get-checksums -c integrationtest2 -i logback.xml
- Put a file with a different file-id to all pillars
- Run put command on a file and use the file-id parameter (-i)
bash bin/bitmag.sh put-file -c integrationtest2 -f conf/logback.xml -i putFileTest_2022_03_09
- Verify that it is now present at all pillars, and that it has the same checksum at all pillars
bash bin/bitmag.sh get-file-ids -c integrationtest2 -i putFileTest_2022_03_09
bash bin/bitmag.sh get-checksums -c integrationtest2 -i putFileTest_2022_03_09
- Run put command on a file and use the file-id parameter (-i)
- Put a file by using an URL
- Use the URL and Checksum to put a file, already on the webdav server.
bash bin/bitmag.sh put-file -c integrationtest2 -u http://sandkasse-01.kb.dk/dav/test.txt -i putFileTest_2_2022_03_09.txt -C d41d8cd98f00b204e9800998ecf8427e
- Verify that it is now present at all pillars, with the requested checksum
bash bin/bitmag.sh get-file-ids -c integrationtest2 -i putFileTest_2_2022_03_09.txt
bash bin/bitmag.sh get-checksums -c integrationtest2 -i putFileTest_2_2022_03_09.txt
- Use the URL and Checksum to put a file, already on the webdav server.
Idempotent test
- Attempt to put a file with an fileID that is already present in the collection suppling the same checksum
- The putFile request should succeed.
bash bin/bitmag.sh put-file -c integrationtest2 -f conf/logback.xml
- The putFile request should succeed.
Put with returned checksums
- Put a file including a request of a salted checksum calculated on the pillar, which should be returned.
- Use the request-checksum-algorithm and request-checksum-salt arguments (-R and -S):
bash bin/bitmag.sh put-file -c integrationtest2 -u http://sandkasse-01.kb.dk/dav/test.txt -i putFileTest_3_2022_03_09.txt -C d41d8cd98f00b204e9800998ecf8427e -S abab -R HMAC_SHA1
- Verify that the checksumpillar replies with a checksum of the chosen algorithm.
- Verify that the checksumpillar and all the other pillars have the file
bash bin/bitmag.sh get-file-ids -c integrationtest2 -i putFileTest_3_2022_03_09.txt
- Use the request-checksum-algorithm and request-checksum-salt arguments (-R and -S):
- Put a file including a request for checksum, but using both a salt and a non-salt algorithm.
- Use the request-checksum-algorithm and request-checksum-salt arguments (-R and -S):
bash bin/bitmag.sh put-file -c integrationtest2 -u http://sandkasse-01.kb.dk/dav/test.txt -i putFileTest_4_2022_03_09.txt -C d41d8cd98f00b204e9800998ecf8427e -S abab -R SHA1
- Verify that all the data pillars return the same checksum, and that it is identical to the previous test (where '-R HMAC_SHA1')
- Use the request-checksum-algorithm and request-checksum-salt arguments (-R and -S):
- Put a file including a request for checksum, but using a salt algorithm but not giving a salt.
- Use the request-checksum-algorithm and request-checksum-salt arguments (-R and no -S):
bash bin/bitmag.sh put-file -c integrationtest2 -u http://sandkasse-01.kb.dk/dav/test.txt -i putFileTest_4_2022_03_09.txt -C d41d8cd98f00b204e9800998ecf8427e -R SHA1
- Verify that the data pillars all deliver the same checksum, which must be different from the checksum in the previous two tests. (i.e. it will be of the default checksum, which currently is md5)
- Use the request-checksum-algorithm and request-checksum-salt arguments (-R and no -S):
Error scenarios
- Attempt to put a file with an fileID that is already present in the collection (ensure that the file has a different checksum from the already archived)
- The putFile request should fail informing the user that a file with the given file ID already exists in the collection.
bash bin/bitmag.sh put-file -c integrationtest2 -f conf/RepositorySettings.xml -i putFileTest_2_2022_03_09.txt
The response should be something similar to "Failure: d6ef5b26: PUT_FILE for file putFileTest_2_2022_03_09.txt: FAILED: , Can not put file putFileTest_2_2022_03_09.txt, as an different file already exists on pillar ..."
- The putFile request should fail informing the user that a file with the given file ID already exists in the collection.
- Attempt to put a file which does not exist
- Client should fail immediately
bash bin/bitmag.sh put-file -c integrationtest2 -f ThisFileDoesNotExist
- Client should fail immediately
- Attempt to put a file to a non-existing collection
- Client should fail immediately
bash bin/bitmag.sh put-file -c integrationtest3 -i putFileTest_5_2022_03_09.txt
- Client should fail immediately
Open issues