I was reading something that made me question if I'm implementing testing in my pipeline correctly.
I currently have it setup like the following:
testing
branch for microserviceMy questions are the following:
In other words, is the flow:
Thanks for clarifying.
There are a couple of things I'd rearrange here.
As @DanielMann notes in a comment, your service should have a substantial set of unit tests. These don't require running in a container and don't have dependencies on any external resources; you might be able to use mock implementations of service clients, or alternate implementations like SQLite as an in-process database. Once your CI system sees a commit, before it builds an image, it should run these unit tests.
You should then run as much of the test sequence as you can against the pull request. (If the integration tests fail after you've merged to the main branch, your build is broken, and that can be problematic if you need an emergency fix.) Especially you can build a Docker image from the PR branch. Depending on how your system is set up you may be able to test that directly; either with an alternate plain-Docker environment, or in a dedicated Kubernetes namespace, or using a local Kubernetes environment like minikube or kind.
Absolutely test the same Docker image you will be running in production.
In summary, I'd rearrange your workflow as:
testing
branch for microservice