테스트/부하테스트

ngrinder docker-compose 로 생성후 로컬테스트

blogger903 2024. 6. 13. 23:21
728x90

docker-compose로 ngrinder controller와 agent를 컨테이너로 올린후 로컬호스트에 올라간 스프링부트를 테스트하겠습니다

 

환경

- Apple M2 Pro

- macOS Sonoma

- docker

  - Docker version 24.0.6, build ed223bc

 

docker compose 파일을 생성해줍니다

 

docker-compose.yml

version: '3.8'
services:
  controller:
    image: ngrinder/controller:3.5.6
    platform: linux/amd64
    restart: always
    ports:
      - "8300:80"
      - "16001:16001"
      - "12000-12009:12000-12009"
    volumes:
      - ./ngrinder-controller:/opt/ngrinder-controller
  agent:
    image: ngrinder/agent:3.5.8
    platform: linux/amd64
    restart: always
    links:
      - controller

 

 

도커 컴포즈 명령을 통해 docker container를 띄워줍니다

```

docker compose up -d

```

 

chrome창에 `https://localhost:8300`으로 접속하시면 로그인 창이 나옵니다

controller와 agent가 통신되는지 확인합니다

agent Management에 agent state가 Ready면 잘 설정된것입니다

home으로 돌아와서 script로 이동합니다

 

create 버튼 > create a script를 클릭해줍니다 Script Name "test"를 입력해줍니다

 

get 요청으로 조회 테스트를 해보려고 합니다

agent가 docker container에 있기 때문에 host에 올라간 스프링부트의 IP를 명시해줘야합니다

예시: http://host.docker.internal:<port>/api/members

ip 주소를 host.docker.internal로 명시해주세요

create를 눌러서 script 생성해줍니다

 

home으로 돌아와서 Performance Test를 통해 Create Test를 해주세요

Test Name에 "stress test"로 명시하고

agent는 1, Vuser는 10으로 합니다

 

Show Advanced Configuration을 클릭해서 Connection reset on each test run 해제해주시고 Save and Start로 부하테스트를 실행합니다

 

참고 링크

Connection reset on each test run 
http://ngrinder.373.s1.nabble.com/Connection-reset-on-each-test-run-Connection-refused-td2703.html