Skip to content

Testing

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

In the future, regression tests will be automated, but in the meantime, here's a methodical way of manually testing them.

Synchronization endpoints

Synchronization features are implemented via the following API endpoints, which need to be tested:

Endpoint Purpose
/bucket/:bucketId/sync Sync a particular bucket
/sync Sync with the default bucket
/sync/status Get sync queue size
/object/:objectId/sync Sync a particular object

Note: /sync/status is tested as part of the other sync endpoints.

/bucket/:bucketId/sync

Sync a particular bucket

  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
  5. Assert:
    • {number of files in S3} === {number of files in COMS bucket}
    • {names of files in S3} === {names of files in COMS bucket}

/sync

Sync with the default bucket

Similar to /bucket/:bucketId/sync, but without creating a separate 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
  4. Assert:
    • {number of files in S3} === {number of files in default COMS bucket}
    • {names of files in S3} === {names of files in default COMS bucket}

/object/:objectId/sync

Sync a particular object

  1. Create a COMS bucket (i.e. PUT /bucket) and save the bucketId
  2. Upload file via COMS API (i.e. PUT /object)
  3. Overwrite just-uploaded file with a newer version directly via S3
  4. GET /object/:objectId/sync
  5. 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
  6. Assert:
    • {content of file uploaded via S3} === {content of file retrieved via COMS}
    • {latest version ID of file on S3} === {latest version ID of file on COMS}