duan19805 2018-04-24 01:42
浏览 116
已采纳

如果有多个微服务,我应该如何集成测试它们?

I am learning microservice architecture, but now there is some confusion.

situation

  • there are 4 projects written in golang
    1. orderService
    2. userService
    3. tools
    4. web ( forward HTTP request )
  • orderService , userService, web communicate via grpc
  • all api requests through web forwarding to orderService or userService
  • orderService and userService have their own independent database
  • they are all in docker containers

confusion

when I want to test a request, I have to do the following steps:

cd orderService
govender update +vendor
go build

cd userService
govender update +vendor
go build

cd web
govender update +vendor
go build

docker-compose build
docker-compose up

when I changed some code, I have to do this steps again.
I think this is unscientific and abnormal. I want to know whether all of these steps are necessary to integration test four microservices in docker.

  • 写回答

3条回答 默认 最新

  • dongxie2749 2018-04-24 05:33
    关注

    If you change Go code you have to recompile; that's not abnormal. Go code compiles quickly so that's usually not a big deal.

    I'm not sure why you are running govendor repeatedly. If you are working on a dependency it is often easier to unvendor it temporarily.

    To speed things up, don't use Docker during development; at least not for the Go code. Since Go doesn't have any dependencies beside itself there's no advantage to doing this. You can still run backing services (e.g. a database) in Docker, but you don't have to rebuild and restart that all the time.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题