PutFile tests

Describes the tests needed to validate the PutFile functionality.

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

  1. 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.


      1. 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
      1. bash bin/bitmag.sh get-file-ids -c integrationtest2 -i logback.xml
      2. bash bin/bitmag.sh get-checksums -c integrationtest2 -i logback.xml
  2. Put a file with a different file-id to all pillars
    • Run put command on a file and use the file-id parameter (-i)
      1. 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
      1. bash bin/bitmag.sh get-file-ids -c integrationtest2 -i putFileTest_2022_03_09
      2. bash bin/bitmag.sh get-checksums -c integrationtest2 -i putFileTest_2022_03_09
  3. Put a file by using an URL
    • Use the URL and Checksum to put a file, already on the webdav server.
      1. 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
      1. bash bin/bitmag.sh get-file-ids -c integrationtest2 -i putFileTest_2_2022_03_09.txt
      2. bash bin/bitmag.sh get-checksums -c integrationtest2 -i putFileTest_2_2022_03_09.txt

Idempotent test

  1. Attempt to put a file with an fileID that is already present in the collection suppling the same checksum
    • The putFile request should succeed.
      1. bash bin/bitmag.sh put-file -c integrationtest2 -f conf/logback.xml

Put with returned checksums

  1. 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):
      1. 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
      1. bash bin/bitmag.sh get-file-ids -c integrationtest2 -i putFileTest_3_2022_03_09.txt
  2. 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):
      1. 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')
  3. 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):
      1. 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)

Error scenarios

  1. 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.
      1. bash bin/bitmag.sh put-file -c integrationtest2 -f conf/RepositorySettings.xml -i putFileTest_2_2022_03_09.txt

      2. 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 ..."

  2. Attempt to put a file which does not exist
    • Client should fail immediately
      1. bash bin/bitmag.sh put-file -c integrationtest2 -f ThisFileDoesNotExist
  3. Attempt to put a file to a non-existing collection
    • Client should fail immediately
      1. bash bin/bitmag.sh put-file -c integrationtest3 -i putFileTest_5_2022_03_09.txt

Open issues

key priority summary type created
Loading...
Refresh