<p>I am creating a very small microservices environment for testing purpose. 
It looks as follows: </p>

<p><a href="https://i.stack.imgur.com/eJXL8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eJXL8.png" alt="enter image description here"></a></p>

<p>As you can see on the image, Istio is installed in the k8s cluster to use service mesh.</p>

<p>I wrote the <code>BOO</code> service, but do not know how to test the service, because it calls <code>FOO</code> and <code>ZOO</code> services. </p>

<p>I could mock <code>FOO</code> and <code>ZOO</code> services but when in the future the <code>BOO</code> services calls 10 further services, then it does make any sense then to mock all services.  </p>

<p>What the best way to test my microservices before deploy to kubernetes?     </p>

softshipper
<p>Deploy them to Kubernetes, but somewhere other than your production environment.</p>

<p>There are a couple of straightforward ways to get Kubernetes clusters.  You can use tools like <a href="https://minikube.sigs.k8s.io" rel="noreferrer">minikube</a> or <a href="https://kind.sigs.k8s.io" rel="noreferrer">kind</a> to get a Kubernetes cluster on your local system (in a VM or a Docker container, respectively); if you're in a cloud environment then offerings like Amazon EKS or Google GKE can give you a cluster as large or small as you want.  Once you have the cluster you can install tools like Helm (v2) and Istio on it, and then run the exact same deployment scripts you normally do to deploy your services into that cluster.</p>

<p>If this becomes a large number of services, it could be useful to leave a test environment running all the time, and set up your CI system to deploy into both the production and test environments.</p>

<p>Even with this there is room for the mock approach you describe here: it is vastly easier to test and debug a service using its local unit-test tree than to deploy it somewhere.  I generally write unit tests based on mock services, and then also write integration tests based on a deployed set of services (and if the integration tests fail, reproduce the issue with the mocks).</p>
