Skip to content

test: switched aws sdk tests to localstack - #2708

Open
abhilash-sivan wants to merge 37 commits into
mainfrom
chore-aws-sdk
Open

test: switched aws sdk tests to localstack#2708
abhilash-sivan wants to merge 37 commits into
mainfrom
chore-aws-sdk

Conversation

@abhilash-sivan

@abhilash-sivan abhilash-sivan commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

refs https://jsw.ibm.com/browse/INSTA-108647

  • added localstack support for aws tests
  • to run against real AWS instead of LocalStack, log in and unset set RUN_AWS

test result: https://ibm.box.com/s/c4kttm6qsxcb2sizhev1lkz28giw4w6j

@abhilash-sivan abhilash-sivan changed the title test: switched aws dynamodb test to localstack test: switched aws sdk tests to localstack Aug 11, 2026
const availableCtx = [null, '{"Custom": {"awesome_company": "Instana"}}', '{"Custom": "Something"}'];
const requestMethods = ['Callback', 'Promise'];
const availableOperations = ['invoke', 'invokeAsync'];
const availableOperations = ['invoke'];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

self note: check invokeAsync

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

https://docs.localstack.cloud/aws/services/lambda/#api-coverage

invokeAsync is not supported by localstack

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We removed invokeAsync completely? This is really concerning.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added back for actual AWS test

@abhilash-sivan
abhilash-sivan marked this pull request as ready for review August 12, 2026 10:25
@abhilash-sivan
abhilash-sivan requested a review from a team as a code owner August 12, 2026 10:25
Comment thread packages/aws-lambda/src/ssm.js Outdated
Comment thread packages/aws-lambda/test/integration_test/test_definition.js Outdated
Comment thread .tekton/templates/test-task.yaml.template Outdated
const availableCommands = {
PublishCommand: {
Message: 'STRING_VALUE',
TargetArn: 'STRING_VALUE',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you manually edit these?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, do we have a script to add sidecars? I though no

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤔 But these are test groups files. These are generated not?

.tekton/tasks/test-groups/aws-lambda-split-2-task.yaml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The 'generate test files' script does not make any changes. So the addition is correct right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The sidecars are automatically added to the generated test files.
No manual edits in the generated files

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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'] },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I thought aws lambda pkg does not run against AWS? Why do we have to change that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We have 2 tests SSM and KMS client tests, running against AWS in this package

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

#1649

Its all packages except aws lambda. I remembered wrong.

Comment thread packages/collector/test/integration/currencies/cloud/aws-sdk/lambda/app.mjs Outdated
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'];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

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.

3 participants