By using AWS re:Post, you agree to the Terms of Use
/Testing Greengrass Components Before Deployment with IPC/

Testing Greengrass Components Before Deployment with IPC


I would like to be able to perform local testing of my greengrass components before deployment. The issue is that my components normally use Greengrass IPC, meaning that I cannot perform local testing, as IPC messages cannot be sent/received as the local component test won't be happening in Greengrass.

Is there a way to get around this ? Is there a method to mimic/test Greengrass IPC calls in a program, outside of a Greengrass deployment ?

1 Answers

Hi. If you get your component into a unit test harness, you could mock the IPC calls and achieve a lot of automated test coverage. A very small example of IPC mocking:

If you are prepared to deploy the component locally (on your developer machine) to a Greengrass instance, you could also achieve integration testing of the component (assuming the component doesn't have dependencies on hardware that is not available on your developer machine). You could:

  • Use the Greengrass CLI to deploy your component locally (quickly, easily and repeatedly while developing).
  • Configure your local Greengrass to interact with local client devices by deploying the MQTT broker (Moquette), MQTT bridge, Client device auth and IP detector components.
  • Configure the MQTT bridge topic mapping to relay the appropriate topics from Moquette (LocalMqtt) to PubSub and PubSub to Moquette (LocalMqtt). This blog is also helpful.
  • Use an MQTT client of your choice (such as mosquitto_pub and mosquitto_sub) to connect to Moquette as a client device, and do pubsub with your component via the MQTT bridge.
  • You could automate integration testing by getting this into a test framework like Cucumber. And go further by getting this all into a CI/CD pipeline.
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions