Integration Test Using Single Wiremock Server vs Separate TestContainers

I have a Containerized application which uses other containerized apps in environment to consume REST apis.After performing the business logic, it creates file and send it to a remote server using sftp.

Prod Config file looks like this:

app1:
  api:
    url: http://app1:8090

app2:
  api:
    url: http://app2:9339

app3:
  api:
    url: http://app3:8080

remote:
  hostname: test.abc.org
  port: 22

To create the integration tests, I can think of two options:-

1. Using TestContainer for Each dependency

Create separate test container for containerized apps which are exposing apis as well as remote host for file transfer. Wiremock Json mapping files will be passed as volumes in docker-compose and need to update the application-test.yml for test containers reference to localhost.

DockerComposeContainer CONTAINER = new DockerComposeContainer(new File("docker-compose.yml"))
                                .withExposedService("app1", 2929, waitStrategy).withLogConsumer("app1",logConsumer)
                                .withExposedService("app2", 8065, waitStrategy).withLogConsumer("app2",logConsumer)
                                .withExposedService("app3", 8090, waitStrategy).withLogConsumer("app23",logConsumer)
                                .withExposedService("sshserver_1", 2222, waitStrategy).withLogConsumer("sshserver_1",logConsumer)
                                .withLocalCompose(true);

docker-compose.yml:

version: "3.8"
services:

  app3:
    image: rodolpheche/wiremock:2.25.1
    ports:
      - "8090:8090"
    command: --port 8090 --global-response-templating
    volumes:
      - ./mocks/app3-api:/home/wiremock

  app2:
    image: rodolpheche/wiremock:2.25.1
    ports:
      - "8065:8065"
    command: --port 8065 --global-response-templating
    volumes:
      - ./mocks/app2-api:/home/wiremock

  sshserver:
    build:
      context: mocks/remote
    ports:
      - "2222:2222"
    volumes:
      - ./mocks/remote/files:/files

  app1:
    image: rodolpheche/wiremock:2.25.1
    ports:
      - "2929:2929"
    command: --port 2929 --global-response-templating
    volumes:
      - ./mocks/app1-api:/home/wiremock

2. Create single Wiremock Server for All APIs and Separate TestContainer for Remote Server

create single wiremock server by passing all mapping directories to wiremock configuration object and point all api server in test yml to localhost wiremock port. Although still in this case I belive I have to create a testcontainer for ssh remote server as I have to test file transfer.

WireMockConfiguration configuration = WireMockConfiguration.options()
                .port(8085)
                .usingFilesUnderDirectory("./mocks/app1/files")  // Load mappings from "mappings/api1"
                .usingFilesUnderDirectory("./mocks/app2/files")
                .usingFilesUnderDirectory("./mocks/app3/files")  // Load mappings from "mappings/api1"
        // Start WireMock server with the configured options
        wireMockServer = new WireMockServer(configuration);
        wireMockServer.start();
 

I am seeking suggestions on below:

  1. While both seems equivalent to me in terms of functioning, I want to understand if there’s a significant difference in both approaches that can impact testing or performance.

  2. which one is recommended ?

9

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật