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

fix(parser): event type literal for selfManagedKafka #3325

Merged

Conversation

am29d
Copy link
Contributor

@am29d am29d commented Nov 18, 2024

Summary

This PR fixes the bug for event type literal for self managed kafka events.

Changes

Beside the literal change I had to remove --changed flag, as it prevented me from push due to wrong coverage. When running the pre-push tests the coverage for unrelated files which were not affected by the changes were reporting low coverage. In my case it was SQS envelope, which has nothing to do with the kafka schema changes.


 ✓ |@aws-lambda-powertools/parser| tests/unit/parser.decorator.test.ts (8)
 ✓ |@aws-lambda-powertools/parser| tests/unit/parser.middy.test.ts (13)
 ✓ |@aws-lambda-powertools/parser| tests/unit/envelopes/apigw.test.ts (7)
 ✓ |@aws-lambda-powertools/parser| tests/unit/envelopes/apigwv2.test.ts (7)
 ✓ |@aws-lambda-powertools/parser| tests/unit/envelopes/cloudwatch.test.ts (5)
 ✓ |@aws-lambda-powertools/parser| tests/unit/envelopes/dynamodb.test.ts (7)
 ✓ |@aws-lambda-powertools/parser| tests/unit/envelopes/eventbridge.test.ts (7)
 ✓ |@aws-lambda-powertools/parser| tests/unit/envelopes/kafka.test.ts (6)
 ✓ |@aws-lambda-powertools/parser| tests/unit/envelopes/kinesis-firehose.test.ts (11)
 ✓ |@aws-lambda-powertools/parser| tests/unit/envelopes/kinesis.test.ts (6)
 ✓ |@aws-lambda-powertools/parser| tests/unit/envelopes/lambda.test.ts (7)
 ✓ |@aws-lambda-powertools/parser| tests/unit/envelopes/sns.test.ts (12)
 ✓ |@aws-lambda-powertools/parser| tests/unit/envelopes/vpc-lattice.test.ts (8)
 ✓ |@aws-lambda-powertools/parser| tests/unit/envelopes/vpc-latticev2.test.ts (8)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/alb.test.ts (3)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/apigw.test.ts (11)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/apigwv2.test.ts (9)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/cloudformation-custom-resource.test.ts (3)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/cloudwatch.test.ts (2)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/dynamodb.test.ts (1)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/eventbridge.test.ts (1)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/kafka.test.ts (5)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/kinesis.test.ts (10)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/lambda.test.ts (2)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/s3.test.ts (10)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/ses.test.ts (2)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/sns.test.ts (4)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/sqs.test.ts (2)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/vpc-lattice.test.ts (2)
 ✓ |@aws-lambda-powertools/parser| tests/unit/schema/vpc-latticev2.test.ts (2)

 Test Files  30 passed (30)
      Tests  181 passed (181)
   Start at  10:18:58
   Duration  3.13s (transform 10ms, setup 477ms, collect 5.53s, tests 296ms, environment 4ms, prepare 2.60s)

 % Coverage report from v8
------------------------------------|---------|----------|---------|---------|-------------------
File                                | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
------------------------------------|---------|----------|---------|---------|-------------------
All files                           |      98 |      100 |    97.5 |      98 |                   
 src                                |     100 |      100 |     100 |     100 |                   
  errors.ts                         |     100 |      100 |     100 |     100 |                   
  index.ts                          |     100 |      100 |     100 |     100 |                   
  parser.ts                         |     100 |      100 |     100 |     100 |                   
  parserDecorator.ts                |     100 |      100 |     100 |     100 |                   
 src/envelopes                      |   95.46 |      100 |   96.66 |   95.46 |                   
  apigw.ts                          |     100 |      100 |     100 |     100 |                   
  apigwv2.ts                        |     100 |      100 |     100 |     100 |                   
  cloudwatch.ts                     |     100 |      100 |     100 |     100 |                   
  dynamodb.ts                       |     100 |      100 |     100 |     100 |                   
  envelope.ts                       |     100 |      100 |     100 |     100 |                   
  event-bridge.ts                   |     100 |      100 |     100 |     100 |                   
  index.ts                          |     100 |      100 |     100 |     100 |                   
  kafka.ts                          |     100 |      100 |     100 |     100 |                   
  kinesis-firehose.ts               |     100 |      100 |     100 |     100 |                   
  kinesis.ts                        |     100 |      100 |     100 |     100 |                   
  lambda.ts                         |     100 |      100 |     100 |     100 |                   
  sns.ts                            |     100 |      100 |     100 |     100 |                   
  sqs.ts                            |    27.5 |      100 |      50 |    27.5 | 31-61             
  vpc-lattice.ts                    |     100 |      100 |     100 |     100 |                   
  vpc-latticev2.ts                  |     100 |      100 |     100 |     100 |                   
 src/middleware                     |     100 |      100 |     100 |     100 |                   
  parser.ts                         |     100 |      100 |     100 |     100 |                   
 src/schemas                        |     100 |      100 |     100 |     100 |                   
  alb.ts                            |     100 |      100 |     100 |     100 |                   
  apigw-proxy.ts                    |     100 |      100 |     100 |     100 |                   
  apigw.ts                          |     100 |      100 |     100 |     100 |                   
  apigwv2.ts                        |     100 |      100 |     100 |     100 |                   
  cloudformation-custom-resource.ts |     100 |      100 |     100 |     100 |                   
  cloudwatch.ts                     |     100 |      100 |     100 |     100 |                   
  dynamodb.ts                       |     100 |      100 |     100 |     100 |                   
  eventbridge.ts                    |     100 |      100 |     100 |     100 |                   
  index.ts                          |     100 |      100 |     100 |     100 |                   
  kafka.ts                          |     100 |      100 |     100 |     100 |                   
  kinesis-firehose.ts               |     100 |      100 |     100 |     100 |                   
  kinesis.ts                        |     100 |      100 |     100 |     100 |                   
  lambda.ts                         |     100 |      100 |     100 |     100 |                   
  s3.ts                             |     100 |      100 |     100 |     100 |                   
  ses.ts                            |     100 |      100 |     100 |     100 |                   
  sns.ts                            |     100 |      100 |     100 |     100 |                   
  sqs.ts                            |     100 |      100 |     100 |     100 |                   
  vpc-lattice.ts                    |     100 |      100 |     100 |     100 |                   
  vpc-latticev2.ts                  |     100 |      100 |     100 |     100 |                   
------------------------------------|---------|----------|---------|---------|-------------------
ERROR: Coverage for lines (98%) does not meet global threshold (100%)
ERROR: Coverage for functions (97.5%) does not meet global threshold (100%)
ERROR: Coverage for statements (98%) does not meet global threshold (100%)

I like the idea of running only change related files to save time, it was always bothering me. I looked into vites config and probed few solutions but with no results. We should add the flag at some point once we figured out what is causing the wrong coverage.

Please provide a summary of what's being changed

Please add the issue number below, if no issue is present the PR might get blocked and not be reviewed

Issue number: closes #3324


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@am29d am29d requested review from a team as code owners November 18, 2024 09:30
@boring-cyborg boring-cyborg bot added internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) parser This item relates to the Parser Utility tests PRs that add or change tests labels Nov 18, 2024
@pull-request-size pull-request-size bot added the size/XS PR between 0-9 LOC label Nov 18, 2024
@github-actions github-actions bot added the bug Something isn't working label Nov 18, 2024
Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

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

Thank you for the fix.

I've heard about the coverage issue from another contributor but never managed to reproduce it, but it makes sense.

The alternative would've been to remove coverage from this pre-push run altogether but with the new runner I don't think speed is a concern anymore.

@am29d am29d merged commit 5350afe into main Nov 18, 2024
37 checks passed
@am29d am29d deleted the issue3324/Bug-KafkaSelfManagedEventModel-eventSource-not-correct branch November 18, 2024 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) parser This item relates to the Parser Utility size/XS PR between 0-9 LOC tests PRs that add or change tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: KafkaSelfManagedEventModel eventSource not correct
2 participants