<p>If nothing exists to easily mock Consul, have you considered spinning up a Consul service along with your other microservices? Consul can run in Docker, so this should be fairly straightforward if you use docker-compose and your apps can be configured to point to a different Consul endpoint.</p>

<p>Once your docker-compose is configured to spin up all the infrastructure/microservices required for your test, you will be able to use whatever tools you're familiar with to test your microservices, e.g. Selenium.</p>

CC BY-SA 4.0
2021-01-09T07:47:16.597Z
The OP is talking about VMs, not docker.
Software Engineer
CC BY-SA 3.0
2017-09-23T03:14:13.650Z
2017-09-23T03:14:13.650Z
user2640621
<p>I like SaltStack because the configuration management provides node testing if you want in the states, per node, and the results are coalesced in the job status and fully accounted for in the returners.</p>

<p>SaltStack states also allow you to generate events on successes or failures, and it allows nodes to advertise (mines) arbitrary endpoint data (ie. which ip:port is it listening on), available to other nodes' configuration states.</p>

<p>The combination of the two gets you what you probably want from Consul.</p>

CC BY-SA 3.0
2017-10-26T09:07:17.173Z
How does it compare to consul in term of service availability ? If one node of a dependent service has fall in OOM 3 hours after your salt job returned, how would you remove this node from the service cluster and avoid your deploying job to call it ? I think the last line is absolutely out of scope.
Tensibai
CC BY-SA 3.0
2017-10-25T18:47:40.910Z
2017-10-26T02:33:57.697Z
2017-10-26T02:33:57.697Z
Jeremy
<p>locally you can test against <a href="https://kind.sigs.k8s.io/docs/user/quick-start/" rel="nofollow noreferrer">kind</a> (kubernetes in docker) cluster or <a href="https://k3d.io/usage/commands/" rel="nofollow noreferrer">k3d</a> which is tiny k3s cluster in docker.</p>
<p>Just spin up the cluster, install bundle of microservices there and run the tests.</p>
<p>Have a look on <a href="https://github.com/AbsaOSS/k3d-action" rel="nofollow noreferrer">https://github.com/AbsaOSS/k3d-action</a> which demonstrates spinning such cluster.</p>

CC BY-SA 4.0
2021-01-09T07:46:15.837Z
The OP is talking about VMs, not even docker, let alone K8S.
Software Engineer
CC BY-SA 4.0
2021-01-13T10:34:55.893Z
please explain what ha change if you use VM's instead of dockers. I think the docker with kubernetes is the most common way how to test mictroservices. Also, please can you point to place where he is talking about VM? Thanks for minus!
Michal K
CC BY-SA 4.0
2021-01-13T10:48:53.900Z
It's the 3rd comment under the question. Although I'm a K8S trainer I'd have to contest your assertion that the most common way to do microservices is k8s. K8S is great, and growing in popularity, but most organisations are still only in the early days of adoption, and, 3-years ago when this question was asked K8S was a terrifying dream in the eyes of most companies. If you use VMs instead of docker/k8s there is no need to learn an entirely new suite of tools. Also, while k3d is great, if you don't already have a k8s configuration it is far from simple to just 'install bundle of ms'.
Software Engineer
CC BY-SA 4.0
2021-01-07T09:22:11.287Z
2021-01-07T09:22:11.287Z
Michal K
<p>I took a look into <a href="http://serverspec.org/" rel="noreferrer">Server Spec</a> and it says it clearly: </p>

<blockquote>
  <p>Remark: serverspec test suites are meant to be run against a single machine  (or docker container). In other words, you should not try to issue a single rspec command that would harvest and run tests against multiple machines or containers. You need to issue one rspec command for each of them.</p>
</blockquote>

<p>So I can do test per-server, which is good for some cases. But the problem is the following: my microservice architecture has a auto-discovery service, so some services are known after querying it. Is there any project to express this? I know I can tool around with ruby (or python if I choose  <a href="http://testinfra.readthedocs.io/en/latest/examples.html" rel="noreferrer" title="testinfra">testinfra</a> or other) </p>

<p>Something integrates with Consul with serverspec or similar will be great, <a href="https://groups.google.com/forum/#!topic/consul-tool/PMKN_hop8Ec" rel="noreferrer">in 2014 people were looking for this</a>, does anyone know of any project that tackled this issue?</p>

CC BY-SA 3.0
2017-03-30T21:12:12.140Z
I think you are misunderstanding run on a single instance (whatever the external needs are) with testing multiple instances within the same run.
Tensibai
CC BY-SA 3.0
2017-03-31T10:03:21.450Z
How are your microservices hosted? Docker Containers?
Richard Slater
CC BY-SA 3.0
2017-03-31T11:38:09.383Z
My microservices are running in VMs and some of them in Physical Machines (we do genetics, so there is some on-prem clusters next to sequencers)
nicocesar
CC BY-SA 3.0
2017-04-02T17:18:45.477Z
I have found this article helpful if anyone has time to make use of it.  https://www.toptal.com/nodejs/nodejs-guide-integration-tests
avi
CC BY-SA 3.0
2017-06-21T13:28:32.670Z
Please clarify on type of testing you're looking for, there are different approaches to address system/integration testing of server configuration using for example ServerSpec or KitchenCI, or testing that microservice is up and running using simple HTTP request that each microservice should implement, and different in nature end-to-end application testing can be whitebox/blackbox using for example BDD automation test frameworks or Selenium.
rombob
<testing><microservices>
How to test a cluster of microservices?
nicocesar
# How to test a cluster of microservices?

(Asked by: username_0 on 2017-03-30)

I took a look into [Server Spec](http://serverspec.org/) and it says it clearly:

> Remark: serverspec test suites are meant to be run against a single machine (or docker container). In other words, you should not try to issue a single rspec command that would harvest and run tests against multiple machines or containers. You need to issue one rspec command for each of them.

So I can do test per-server, which is good for some cases. But the problem is the following: my microservice architecture has a auto-discovery service, so some services are known after querying it. Is there any project to express this? I know I can tool around with ruby (or python if I choose [testinfra](http://testinfra.readthedocs.io/en/latest/examples.html "testinfra") or other)

Something integrates with Consul with serverspec or similar will be great, [in 2014 people were looking for this](https://groups.google.com/forum/#!topic/consul-tool/PMKN_hop8Ec), does anyone know of any project that tackled this issue?

**Tags:** testing, microservices

> **Comments:**
> **username_1**: I think you are misunderstanding run on a single instance (whatever the external needs are) with testing multiple instances within the same run.  
> **username_2**: How are your microservices hosted? Docker Containers?  
> **username_0**: My microservices are running in VMs and some of them in Physical Machines (we do genetics, so there is some on-prem clusters next to sequencers)  
> **username_3**: I have found this article helpful if anyone has time to make use of it.  https://www.toptal.com/nodejs/nodejs-guide-integration-tests  
> **username_4**: Please clarify on type of testing you're looking for, there are different approaches to address system/integration testing of server configuration using for example ServerSpec or KitchenCI, or testing that microservice is up and running using simple HTTP request that each microservice should implement, and different in nature end-to-end application testing can be whitebox/blackbox using for example BDD automation test frameworks or Selenium.  

---

## 3 answers

### Answer by username_5 on 2017-09-23. Score: 1

If nothing exists to easily mock Consul, have you considered spinning up a Consul service along with your other microservices? Consul can run in Docker, so this should be fairly straightforward if you use docker-compose and your apps can be configured to point to a different Consul endpoint.

Once your docker-compose is configured to spin up all the infrastructure/microservices required for your test, you will be able to use whatever tools you're familiar with to test your microservices, e.g. Selenium.

> **Comments:**
> **username_6**: The OP is talking about VMs, not docker.  

---

### Answer by username_7 on 2017-10-25. Score: 1

I like SaltStack because the configuration management provides node testing if you want in the states, per node, and the results are coalesced in the job status and fully accounted for in the returners.

SaltStack states also allow you to generate events on successes or failures, and it allows nodes to advertise (mines) arbitrary endpoint data (ie. which ip:port is it listening on), available to other nodes' configuration states.

The combination of the two gets you what you probably want from Consul.

> **Comments:**
> **username_1**: How does it compare to consul in term of service availability ? If one node of a dependent service has fall in OOM 3 hours after your salt job returned, how would you remove this node from the service cluster and avoid your deploying job to call it ? I think the last line is absolutely out of scope.  

---

### Answer by username_8 on 2021-01-07. Score: -1

locally you can test against [kind](https://kind.sigs.k8s.io/docs/user/quick-start/) (kubernetes in docker) cluster or [k3d](https://k3d.io/usage/commands/) which is tiny k3s cluster in docker.

Just spin up the cluster, install bundle of microservices there and run the tests.

Have a look on <https://github.com/AbsaOSS/k3d-action> which demonstrates spinning such cluster.

> **Comments:**
> **username_6**: The OP is talking about VMs, not even docker, let alone K8S.  
> **username_8**: please explain what ha change if you use VM's instead of dockers. I think the docker with kubernetes is the most common way how to test mictroservices. Also, please can you point to place where he is talking about VM? Thanks for minus!  
> **username_6**: It's the 3rd comment under the question. Although I'm a K8S trainer I'd have to contest your assertion that the most common way to do microservices is k8s. K8S is great, and growing in popularity, but most organisations are still only in the early days of adoption, and, 3-years ago when this question was asked K8S was a terrifying dream in the eyes of most companies. If you use VMs instead of docker/k8s there is no need to learn an entirely new suite of tools. Also, while k3d is great, if you don't already have a k8s configuration it is far from simple to just 'install bundle of ms'.  

---

