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'
}]
}]
}
- 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 toexample/lambdas.yml
- Added
VerifyGranules
step toSyncGranule
workflow inexample/workflows/sips.yml
- 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