Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ecarton/cumulus 3751 pg update #3916

Open
wants to merge 49 commits into
base: ecarton/cumulus-3751-s3-task
Choose a base branch
from

Conversation

etcart
Copy link
Contributor

@etcart etcart commented Feb 5, 2025

Summary: adds Postgres update task to change granules over to new pg details for new collection

Addresses CUMULUS-3751: Develop amazing new feature

Changes

  • added pg update task
    (still need to) add to workflow integration test to include this

PR Checklist

  • Update CHANGELOG
  • Unit tests
  • Ad-hoc testing - Deploy changes and test manually
  • Integration tests

etcart added 24 commits January 28, 2025 14:08
@etcart etcart marked this pull request as ready for review February 5, 2025 16:42
@etcart etcart changed the base branch from release-18.5.x to ecarton/cumulus-3751-s3-task February 6, 2025 15:30
Copy link
Contributor

@Nnaga1 Nnaga1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some comments/questions and a couple NITS

ingestExecutionArn = await buildAndStartWorkflow(
stackName,
config.bucket,
'IngestAndPublishGranuleWithOrca',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this workflow: 'IngestAndPublishGranuleWithOrca',? how does that play into this test/task?

);
});

describe('under normal circumstances', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: more descriptive title for this describe

//upload to cumulus
try {
const { $metadata, Payload } = await lambda().send(new InvokeCommand({
FunctionName: `${stackName}-ChangeGranuleCollectionS3`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming this needs to be ran first before the PG change? can this be moved to the beforeAll or is it better to just have it here 🤔 since the test is meant to test PG

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall the test looks great 🙌

@@ -0,0 +1,2 @@
/nyc.config.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: should /src/ be included in this file?

tasks/change-granule-collection-pg/README.md Show resolved Hide resolved
const sinon = require('sinon');
const { createSnsTopic } = require('@cumulus/aws-client/SNS');
const { generateLocalTestDb, migrationDir, GranulePgModel, CollectionPgModel, translateApiCollectionToPostgresCollection, translateApiGranuleToPostgresGranule, localStackConnectionEnv } = require('@cumulus/db');

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for a db test like this, do you not need this stuff:

process.env.AccessTokensTable = randomId('token');
process.env.stackName = randomId('stackname');
process.env.system_bucket = randomId('system-bucket');
process.env.TOKEN_SECRET = randomId('secret');
process.env.backgroundQueueUrl = randomId('backgroundQueueUrl');

);
pgRecords.granules = await granuleModel.insert(
knex,
await Promise.all(granules.map(async (g) => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: naming from g -> granule

t.context.esIndex = esIndex;
t.context.esClient = esClient;

t.context.knexAdmin = knexAdmin;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is all this bucket stuff needed just for this? what is it doing in this case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 130-160ish

"sampleFileName": "BROWSE.MOD11A1.A2017200.h19v04.006.2017201090724.hdf",
"bucket": "private"
},
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need this for unit tests, why not just use the fakeFactories stuff instead, unless there is a deliberate need I'm not understanding (bc its task/workflow....etc.)?

uploadTestDataToBucket(config.bucket, s3data, sourceGranulePath),
addCollections(stackName, config.bucket, collectionsDir, testSuffix, testId),
addCollections(stackName, config.bucket, targetCollectionsDir, testSuffix, testId),
addProviders(stackName, config.bucket, providersDir, config.bucket, testSuffix),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would you need providers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants