Skip to content

Testing

Norris Ng edited this page Aug 28, 2023 · 16 revisions

In the future, regression may possibly be automated, but in the meantime, here's a list of test cases to run through.

Synchronization

Sync a particular bucket

Sync a particular bucket so that COMS tracks all of the files in the corresponding S3 bucket.

πŸ“ Preconditions

  • An existing S3 bucket is available

🟒 Test case: create COMS bucket for S3 bucket with existing objects

  1. Upload some files directly to an S3 bucket
  2. Create a COMS bucket (i.e. PUT /bucket) for said S3 bucket and save the bucketId
    • Test both versioned and non-versioned buckets (in a separate test, of course)
  3. GET /bucket/:bucketId/sync
  4. Call GET /sync/status every few seconds, until it returns 0
    • On the first call, assert that it returns {number of files uploaded via S3}
    • Continue to call the endpoint every few seconds until returns 0
Pass criteria
  • {number of files in COMS bucket} === {number of files in S3}
  • {names of files in COMS bucket} === {names of files in S3}

🟒 Test case: directly uploading files via S3

  1. Create a COMS bucket (i.e. PUT /bucket) and save the bucketId
    • Test both versioned and non-versioned buckets (in a separate test, of course)
  2. Upload some files directly via S3
  3. GET /bucket/:bucketId/sync
  4. Call GET /sync/status every few seconds, until it returns 0
    • On the first call, assert that it returns {number of files uploaded via S3}
    • Continue to call the endpoint every few seconds until returns 0
Pass criteria
  • {number of files in COMS bucket} === {number of files in S3}
  • {names of files in COMS bucket} === {names of files in S3}

Sync the default bucket

Sync the default bucket so that COMS tracks all of the files in the corresponding S3 bucket.

πŸ“ Preconditions

  • COMS has been configured with a default S3 bucket

🟒 Test case: upload some files to the default bucket

  1. Upload some files directly via S3
  2. GET /sync
  3. Call GET /sync/status every few seconds, until it returns 0
    • On the first call, assert that it returns {number of files uploaded via S3}
    • Continue to call the endpoint every few seconds until returns 0
Pass criteria
  • {number of files in default COMS bucket} === {number of files in S3}
  • {names of files in default COMS bucket} === {names of files in S3}

Sync a particular object (unversioned S3 buckets)

Sync a particular object so that COMS tracks all of the changes in the corresponding S3 object.

πŸ“ Preconditions

  • There is a COMS bucket that links to an existing unversioned S3 bucket

🟒 Test case: update existing object

  1. Upload file via COMS API (i.e. PUT /object)
  2. Overwrite just-uploaded file directly via S3
  3. GET /object/:objectId/sync
  4. Call GET /sync/status every few seconds
    • On the first call, assert that it returns 1
    • Continue to call the endpoint every few seconds until returns 0
Pass criteria
  • {contents of file retrieved via COMS} === {contents of file uploaded via S3}

🟒 Test case: sync object with no new changes

  1. Upload file via COMS API (i.e. PUT /object)
  2. GET /object/:objectId/sync
  3. GET /sync/status
  4. GET /object/:objectId/
Pass criteria
  • GET /sync/status returns 0
  • {contents of file retrieved via COMS} === {contents of file uploaded via S3}

🟒 Test case: deleting an object

  1. Upload file via COMS API (i.e. PUT /object)
  2. Delete file directly via S3
  3. GET /object/:objectId/sync
  4. Call GET /sync/status every few seconds, until it returns 0
    • On the first call, assert that it returns 1
    • Continue to call the endpoint every few seconds until returns 0
  5. GET /object/:objectId/
Pass criteria
  • GET /object/:objectId/ returns HTTP 404

Sync a particular object (versioned S3 buckets)

Sync a particular object so that COMS tracks all of the changes in the corresponding S3 object.

πŸ“ Preconditions

  • There is a COMS bucket that links to an existing versioned S3 bucket

🟒 Test case: update existing object

  1. Upload file via COMS API (i.e. PUT /object)
  2. Overwrite just-uploaded file with a newer version directly via S3
  3. GET /object/:objectId/sync
  4. Call GET /sync/status every few seconds
    • On the first call, assert that it returns 1
    • Continue to call the endpoint every few seconds until returns 0
  5. GET /object/:objectId/
Pass criteria
  • {contents of file retrieved via COMS} === {contents of file uploaded via S3}
  • {latest version ID of file on COMS} === {latest version ID of file on S3}

🟒 Test case: sync object with no new changes

  1. Upload file via COMS API (i.e. PUT /object)
  2. GET /object/:objectId/sync
  3. GET /sync/status
  4. GET /object/:objectId/
Pass criteria
  • GET /sync/status returns 0
  • {contents of file retrieved via COMS} === {contents of file uploaded via S3}
  • {latest version ID of file on COMS} === {latest version ID of file on S3}

🟒 Test case: soft-deleting objects

  1. Upload file via COMS API (i.e. PUT /object)
  2. Delete latest version of object directly via S3
  3. GET /object/:objectId/sync
  4. Call GET /sync/status every few seconds, until it returns 0
    • On the first call, assert that it returns 1
    • Continue to call the endpoint every few seconds until returns 0
  5. GET /object/:objectId/
Pass criteria
  • {contents of file retrieved via COMS} === {contents of file uploaded via S3}
  • {latest version ID of file on COMS} === {latest version ID of file on S3}

🟒 Test case: undoing a soft deletion directly via S3

  1. Upload file via COMS API (i.e. PUT /object)
  2. Delete object via COMS API, specifying the S3 version ID (i.e. DELETE /object/{objectId}?s3VersionId={s3VersionId})
  3. Restore deleted version directly via S3 (i.e. by removing the delete marker on the version deleted in Step 2)
  4. GET /object/:objectId/sync
  5. Call GET /sync/status every few seconds, until it returns 0
    • On the first call, assert that it returns 1
    • Continue to call the endpoint every few seconds until returns 0
  6. GET /object/:objectId/
Pass criteria
  • {content of file retrieved via COMS} === {contents of file version restored in S3}
  • {latest version ID of file on COMS} === {latest version ID of file on S3}