Testing Greengrass Components Before Deployment with IPC

0

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 ?

preguntada hace 2 años670 visualizaciones
2 Respuestas
0

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.
profile pictureAWS
EXPERTO
Greg_B
respondido hace 2 años
0

On my development GG v2 device I ran a basic component that logged the env variables: AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT SVCUID

I then set these in my .env file and passed them to the component I was developing while greengrass was also running on the same machine. the greengrass IPC then works as expected outside of an active deployment.

respondido hace 9 meses

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas