Skip to content

Instantly share code, notes, and snippets.

@chuckwondo
Last active June 17, 2019 10:52
Show Gist options
  • Save chuckwondo/95e456a5a091e5372f28db9013dbc17b to your computer and use it in GitHub Desktop.
Save chuckwondo/95e456a5a091e5372f28db9013dbc17b to your computer and use it in GitHub Desktop.
Cumulus Verify Granules

Cumulus Verify Granules

Task

Write a new Lambda function using Node.js that validates the checksums of granule files based on the following guidelines:

  • If all checksums are valid, the lambda handler should return nothing
  • If any checksums are invalid, the lambda handler should throw a specific error
  • If a file does not include a checksum or checksum type, ignore it

Input to the Lambda function looks like so:

{
  granules: [{
    granuleId: 'ID',
    files: [{
      filename: 's3://bucket/some/key',
      bucket: 'bucket',
      name: 'key',
      checksumType: 'md5',
      checksum: 'value'
    }]
  }]
}

Status

  • Created a new task in tasks/verify-granules/
  • Created unit tests in tasks/verify-granules/tests/ (all passing)
    • Success when all checksums match
    • Success when mix of matching checksums and missing checksum
    • Failure when one checksum does not match
  • Added VerifyGranules lambda to example/lambdas.yml
  • Added VerifyGranules step to SyncGranule workflow in example/workflows/sips.yml

Next Steps

  • Remove the checksum verification logic from the SyncGranule step
  • Write an integration test that shows a successful workflow when all supplied checksums match calculated checksums
  • Write an integration test that shows a failed workflow when any supplied checksum does not match the corresponding calculated checksum
  • Improve input validation to avoid throwing unexpected exceptions
  • Consider additional unit tests
  • Finish documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment