Git Product home page Git Product logo

Comments (1)

kbastani avatar kbastani commented on September 26, 2024

Thanks for your issue. You make an excellent point about the tests. My goal originally was to make this a very simple project for demonstration purposes. The lack of tests was due to me not having the time to make another guide that articulated a strategy for end-to-end integration testing with microservices. I thought also that contributions might be made by others for the tests, but none have come in.

To answer your questions:

Any plans on adding any integration tests?

Yes, I think it's a good time to add in some tests since the project is becoming pretty popular.

Do you have an approach on your mind to solve the DNS issue pragmatically?

I've been writing about this topic in a book and it has sample applications, similar to this one. There are some integration tests that are rather simple to do, using embedded data sources. The integration tests that are more difficult to resolve are the services where databases cannot be embedded. In this case, the database must be available at some location, whether it is local or remote.

To achieve this on a remote build server, like Travis, I decided to create a Docker image that will use the AWS CLI to create an ephemeral VM instance with Docker Compose installed: https://github.com/kbastani/docker-run-ec2

For a local Maven build, you can use Docker Compose to launch the images that have already been built and added to your local Docker registry. After the containers have started, you can run the Maven tests again and externalize the configuration for each service host. Or, you can just run dependencies as one-off containers. For the discovery service:

$ docker run -ti --rm --name discovery -p 8761:8761 kbastani/discovery-microservice

For the movies-ui project, which you referenced in your log output, the problem was that the discovery service host name couldn't be reached. We can override this in the maven build by exporting the Eureka service URL as a environment variable, like below.

$ export EUREKA_CLIENT_SERVICEURL_DEFAULTZONE=http://192.168.99.100:8761/eureka/
$ mvn test

The log output will now show a successful connection to the discovery service at the overridden Eureka URL.

2016-02-14 01:59:21.737  INFO 1947 --- [           main] com.netflix.discovery.DiscoveryClient    : Disable delta property : false
2016-02-14 01:59:21.737  INFO 1947 --- [           main] com.netflix.discovery.DiscoveryClient    : Single vip registry refresh property : null
2016-02-14 01:59:21.737  INFO 1947 --- [           main] com.netflix.discovery.DiscoveryClient    : Force full registry fetch : false
2016-02-14 01:59:21.737  INFO 1947 --- [           main] com.netflix.discovery.DiscoveryClient    : Application is null : false
2016-02-14 01:59:21.737  INFO 1947 --- [           main] com.netflix.discovery.DiscoveryClient    : Registered Applications size is zero : true
2016-02-14 01:59:21.737  INFO 1947 --- [           main] com.netflix.discovery.DiscoveryClient    : Application version is -1: true
2016-02-14 01:59:21.737  INFO 1947 --- [           main] com.netflix.discovery.DiscoveryClient    : Getting all instance registry info from the eureka server
2016-02-14 01:59:21.837  INFO 1947 --- [           main] com.netflix.discovery.DiscoveryClient    : The response status is 200
2016-02-14 01:59:21.839  INFO 1947 --- [           main] com.netflix.discovery.DiscoveryClient    : Starting heartbeat executor: renew interval is: 30
2016-02-14 01:59:21.918  WARN 1947 --- [       Thread-3] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [current=DOWN, previous=STARTING]
2016-02-14 01:59:21.920  INFO 1947 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_MOVIESUI/10.232.132.65:moviesui:-1: registering service...
2016-02-14 01:59:21.946  INFO 1947 --- [       Thread-3] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_MOVIESUI/10.232.132.65:moviesui:-1 - deregister  status: 404

from spring-cloud-microservice-example.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.