Skip to content

Conversation

enmata
Copy link

@enmata enmata commented Feb 28, 2025

Issue #, if available:
Adding local serverless testing cases to the repository

Description of changes:
Adding AWS serverless testing in a local development environment.

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

@enmata enmata requested a review from dancfox as a code owner February 28, 2025 17:24
@brnkrygs brnkrygs self-assigned this Mar 10, 2025
@enmata enmata requested a review from wtromano-aws as a code owner April 16, 2025 10:56
Copy link
Contributor

@brnkrygs brnkrygs left a comment

Choose a reason for hiding this comment

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

Great changes to bring this into pytest, and guide readers through the different test scenarios and debug situations.

I ran into a few issues running the tests, and commented on the READMEs in those spots. Could you have a look and adjust the instructions appropriately? In some cases, its a matter of adjusting the command or even just the order of commands.

In the "local-lambda" one though, I couldn't get the tests to successfully connect to the step functions local port (I think that's the one anyway). Could you take a look to see if there's a missing command in the instructions?

Thanks for your effort!

Copy link
Contributor

@brnkrygs brnkrygs left a comment

Choose a reason for hiding this comment

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

Making great progress! One of the READMEs looks like it had some accidental content duplication.

The other open issue seems to be with step-functions-local-lambda. I can't seem to get the right combination of local processes running and talking to each other to be able to successfully get through the tests.

Either the ports aren't talking, or one of the emulators/processes isn't running when it needs to be.

Copy link
Contributor

@brnkrygs brnkrygs left a comment

Choose a reason for hiding this comment

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

Very very close now. Commands were working, and flowed nicely. Just a couple of editing tweaks, and a suggestion about using the default --network switch.

```sh
# Runing step functions docker image in the background
step-functions-local-helloworld/tests$
docker run -d --network host \
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm on a mac and had to run in --network bridge mode. According to my research, on Mac (me) and Windows, --network host doesn't provide direct host-network access.

Dropping the switch completely worked for me on my Mac (just taking the default).

> Set up the python environment

``` shell
step-functions-local-helloworld$ cd tests
Copy link
Contributor

Choose a reason for hiding this comment

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

Directory name is incorrect here (and in following commands). Should be step-functions-local-lambda or step-functions-local-lambda/tests

```sh
# Runing step functions docker image in the background
step-functions-local-helloworld/tests$
docker run -d --network host \
Copy link
Contributor

Choose a reason for hiding this comment

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

Same issue as step-functions-local-helloworld, Mac and Windows don't grant host network access in this mode (according to my research). I got a "Could not connect to the endpoint URL: http://localhost:8083" error.

Dropping the switch --network host worked for me.

> unsetting variables

```sh
unset AWS_ACCESS_KEY_ID='DUMMYIDEXAMPLE'
Copy link
Contributor

Choose a reason for hiding this comment

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

unset commands should just be the variable name, and not include ='DUMMYIDEXAMPLE'

@brnkrygs brnkrygs merged commit 61c1839 into aws-samples:main Jul 23, 2025
1 check failed
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