Sanity test


Test for checking the sanity of the system as a whole. This means a roundtrip with only sunshine usage of the system getting through all the core functionality

Sunshine roundtrip

The purpose of the test is to make certain that the core functionality works as expected when behaving nicely. The test is designed such that the system state is the same prior to the test starting and after ending it - provided that the test passes. This also means that the test can be repeated an arbitrary number of times as long as it passes. 

Test procedure

In the following the same fileID is used in all operations. The only restriction is that the fileID is valid for all components in the test, and is not already present in the collection.

  1. List all fileID's to and note which files are present in the collection. 

    ./bin/bitmag.sh get-file-ids -c books
  2. Put a file with an allowed fileID which is not already in the collection. 
    1. Wait for the put file operation to finish with success for all pillars. 

      ./bin/bitmag.sh put-file -c books -f logback.xml
  3. List all files
    1. Verify that the file put in step 2 is present in the listing and that it is present on all pillars in the collection. 

      ./bin/bitmag.sh get-file-ids -c books
    2. Trigger a collection of audittrails, and verify that the new file is present in the list of audit trail events. 

      http://localhost:8080/bitrepository-webclient/audit-trail-service.html
    3. Trigger a full integrity check, and verify that the new file is present and consistent. 

      http://localhost:8080/bitrepository-webclient/integrity-service.html
  4. Request a MD5 checksum for the file.
    1. Verify that all pillars deliver the requested checksum, and that all pillars agree on the checksum value. 

      ./bin/bitmag.sh get-checksums -c books -i logback.xml | grep "3\s\+\w\+\s\+All\s\+logback.xml"
  5. Request a salted checksum request.
    1. Verify that the checksum pillar is unable to perform the operation. 

      ./bin/bitmag.sh get-checksums -c books -i logback.xml -S abab -R md5 -p checksum-pillar
    2. Verify that all full pillars deliver and agree on the new calculation. 

      ./bin/bitmag.sh get-checksums -c books -i logback.xml -S abab -R md5  | grep "2\s\+\w\+\s\+All\s\+logback.xml"
    3. Verify that the salted checksum differs from the non-salted. 

      ./bin/bitmag.sh get-checksums -c books -i logback.xml -R md5 | diff -u - <(sleep 2 && ./bin/bitmag.sh get-checksums -c books -i logback.xml -S abab -R md5)
  6. Get file from pillar
    1. Verify its content is the same as the file that was previously put. 

      md5sum logback.xml | diff -u - <(sleep 2 && ./bin/bitmag.sh get-file -c books -i logback.xml -l logback.tmp.xml > /dev/null && md5sum logback.tmp.xml)
  7. Replace the file with a new file with different content than the original on each pillar. 

    echo "$(cat logback.xml) hello there\!" > logback.changed.xml
    bin/bitmag.sh replace-file -c books -i logback.xml -f logback.changed.xml -C $(md5sum logback.xml | cut -d' ' -f1) -p file1-pillar
    bin/bitmag.sh replace-file -c books -i logback.xml -f logback.changed.xml -C $(md5sum logback.xml | cut -d' ' -f1) -p file2-pillar
    bin/bitmag.sh replace-file -c books -i logback.xml -f logback.changed.xml -C $(md5sum logback.xml | cut -d' ' -f1) -p checksum-pillar
    1. Wait for each pillar to complete the operation.
  8. List all files
    1. Verify that the fileID is still present on all pillars. 

      ./bin/bitmag.sh get-file-ids -c books
  9. Calculate checksum for the file.
    1. Verify that all pillars deliver and agree on the checksum. 

      ./bin/bitmag.sh get-checksums -c books -i logback.xml | grep "3\s\+\w\+\s\+All\s\+logback.xml"
    2. Verify that the checksum differs from the one for the old file. 

      ./bin/bitmag.sh get-checksums -c books -i logback.xml | grep logback.xml | cut -d' ' -f2 | sed 's/\t\+//g' | diff -u - <(md5sum logback.xml | cut -d' ' -f1)
  10. Get file from pillar
    1. Verify that the files content is the same as the file uploaded during the replace action.  (diff will output nothing if the md5sums are equivalent)

      ./bin/bitmag.sh get-file -c books -i logback.xml -l logback.downloaded.xml > /dev/null && md5sum logback.downloaded.xml | cut -d' ' -f1 | diff -u - <(md5sum logback.changed.xml | cut -d' ' -f1)
  11. Delete the file on all pillars
    1. Wait for the operation(s) to complete with success 

      ./bin/bitmag.sh delete-file -c books -i logback.xml -C $(md5sum logback.changed.xml | cut -d' ' -f1) -p file1-pillar
      ./bin/bitmag.sh delete-file -c books -i logback.xml -C $(md5sum logback.changed.xml | cut -d' ' -f1) -p file2-pillar 
      ./bin/bitmag.sh delete-file -c books -i logback.xml -C $(md5sum logback.changed.xml | cut -d' ' -f1) -p checksum-pillar 
  12. List all files
    1. Verify that the file is no longer present on any pillars. 

      ./bin/bitmag.sh get-file-ids -c books -i logback.xml