I am developing different Cloud Functions. Most of the functions have Google-Datastore, Pub/Sub and IoT external dependencies. I would like to run integration tests while deploying using cloudbuild.yaml
.
I can test the unittest via pytest by having this in the cloudbuild.yaml file
steps:
- name: 'python:3.7'
entrypoint: 'bash'
args:
- '-c'
- |
pip3 install -r requirements.txt
pytest
- name: 'gcr.io/cloud-builders/gcloud'
args:
- functions
- deploy
- My-Function
- --runtime=python37
- --source=Soure_Dir
- --entry-point=main
- --trigger-topic=My-Function-Topic
- --region=REGION
Is there any way of writing integration tests to test datastore, pub/sub, iot in this pipline?
or is there any other way of testing the function locally?
What is the efficient way of testing the cloud-functions?