Hey, I’ve been struggling with integration testing...
# help
s
Hey, I’ve been struggling with integration testing dynamodb tables inside my lambdas. Can anyone link tutorial or some kind of documentation on best practice to test dynamodb locally in serverless apps? So far my search has found • Installing Java and trying to run dynamodb locally which Ideally prefer to find a quicker and simpler method • Loading variables into dynamodb config when process.env.IS_OFFLINE. I’m interested to know how people test dynamodb, any suggestions?
Plus, if you could add a bigger section on testing serverless apps in your docs that would be awesome! Righ now it’s a bit lightweight with just integration tests on calculate costs.
r
When we were using serverless framework we did it with DynamoDB local but with SST we can integration test with real, deployed DynamoDB tables
s
Forgive if I’m asking dumb question here, but I need to migrate my lambdas over to sst for this to work (which I’m not opposed) away from serverless framework? Then I could get whole instance up and running with
npx sst start
locally
Right now I have dynamodb, cognito, sns/sqs in sst but lambdas are in serverless framework
r
Yeah, I think lambdas too, shouldn't be much work though
j
@Sam Frampton I’ll also add this if you are trying to figure out how to move over the Lambdas. https://docs.serverless-stack.com/migrating-from-serverless-framework
s
thanks @Jay It’s on my weekend to do list migrate to sst. On paper looks much better than dynamodb-local / serverless offline
j
Yeah, you can play around with an example, if you want to test it out. https://serverless-stack.com/examples/how-to-use-dynamodb-in-your-serverless-app.html
s
Is there a way off top of your head where I could point my lambdas in serverless framework to dynamodb created with sst when running an npm test script with serverless bundle?
Or is it not worth hassle and better off just migrating lambdas to sst. My lambdas make requests to dynamodb tables set up using sst at the moment
j
Let me make sure I understand, your Lambda functions are in Serverless Framework and you want to query your DynamoDB table in them?
s
I may just be talking gibberish due to my lack of understanding, and will take a look at those docs in detail at weekend. Seems like lambda sst set up solves my problem if want local env that can work with aws resources.
j
Ah I see. We don’t have something like that for SST. Like dynamodb local that is.
Yeah SST solves the local development issue by connecting your Lambdas directly to dynamodb. So it doesn’t have a local instance of dyamodb.
s
Ah I wish I set my lambdas up using sst first time round
Oh well
j
Yeah moving over the lambdas shouldn’t be too too bad.