test: switched aws sdk tests to localstack - #2708
Conversation
| const availableCtx = [null, '{"Custom": {"awesome_company": "Instana"}}', '{"Custom": "Something"}']; | ||
| const requestMethods = ['Callback', 'Promise']; | ||
| const availableOperations = ['invoke', 'invokeAsync']; | ||
| const availableOperations = ['invoke']; |
There was a problem hiding this comment.
self note: check invokeAsync
There was a problem hiding this comment.
https://docs.localstack.cloud/aws/services/lambda/#api-coverage
invokeAsync is not supported by localstack
There was a problem hiding this comment.
We removed invokeAsync completely? This is really concerning.
There was a problem hiding this comment.
Added back for actual AWS test
301af84 to
0143312
Compare
| const availableCommands = { | ||
| PublishCommand: { | ||
| Message: 'STRING_VALUE', | ||
| TargetArn: 'STRING_VALUE', |
There was a problem hiding this comment.
in availableCommands, PublishCommand includes both TargetArn and TopicArn (the TopicArn is added in the loop at line 157). AWS SNS won't accept both simultaneously.
There was a problem hiding this comment.
It was working previously because the actual test never ran against AWS, only LS
| AVAILABLE_SIDECARS="" | ||
| SIDECAR_COUNTS="" | ||
| AVAILABLE_SIDECARS="localstack" | ||
| SIDECAR_COUNTS="localstack=1" |
There was a problem hiding this comment.
Did you manually edit these?
There was a problem hiding this comment.
Yes, do we have a script to add sidecars? I though no
There was a problem hiding this comment.
🤔 But these are test groups files. These are generated not?
.tekton/tasks/test-groups/aws-lambda-split-2-task.yaml
There was a problem hiding this comment.
The 'generate test files' script does not make any changes. So the addition is correct right?
There was a problem hiding this comment.
The sidecars are automatically added to the generated test files.
No manual edits in the generated files
There was a problem hiding this comment.
Oky. I was on the wrong branch. The 'generate test files' does make changes, i will update
| 'test:ci:autoprofile': {}, | ||
| 'test:ci:aws-fargate': {}, | ||
| 'test:ci:aws-lambda': { split: 5 }, | ||
| 'test:ci:aws-lambda': { split: 5, sidecars: ['localstack'] }, |
There was a problem hiding this comment.
I thought aws lambda pkg does not run against AWS? Why do we have to change that
There was a problem hiding this comment.
We have 2 tests SSM and KMS client tests, running against AWS in this package
There was a problem hiding this comment.
Its all packages except aws lambda. I remembered wrong.
| const availableCtx = [null, '{"Custom": {"awesome_company": "Instana"}}', '{"Custom": "Something"}']; | ||
| const requestMethods = ['Callback', 'Promise']; | ||
| const availableOperations = ['invoke', 'invokeAsync']; | ||
| const availableOperations = process.env.RUN_AWS ? ['invoke', 'invokeAsync'] : ['invoke']; |
There was a problem hiding this comment.
I think we should add a proper comment here explaining that invokeAsync is currently not supported by LS. We could also consider requesting this feature from the LocalStack team, as they may add support for it in the future.
| this.headers[this.getUserAgentHeaderName()] = [this._userAgent]; | ||
| }; | ||
|
|
||
| function getLocalstackEndpoint() { |
There was a problem hiding this comment.
We’re repeating the same functions in multiple places. Could we move them into a generic test utility file and reuse them across the tests instead? This would help avoid duplication and make them easier to maintain.
There was a problem hiding this comment.
I already tried it. I ran into an issue while copying the files to the test directory from a common location.
Also, there are already utility files in multiple AWS tests, so I think we can keep the functions for now. It also gives us the flexibility to configure each test differently if needed.
I don't think it's worth spending more time optimising this right now
There was a problem hiding this comment.
We define getLocalstackEndpoint() in 15 different places. I think it would be better to move this, along with getClientConfig(), into a common test utility file and reuse them across the tests. We already have a common utilities file for this, so we can avoid duplicating these functions.
0dfc5d0 to
24ed279
Compare
ea4106c to
155279e
Compare
refs https://jsw.ibm.com/browse/INSTA-108647
test result: https://ibm.box.com/s/c4kttm6qsxcb2sizhev1lkz28giw4w6j