diff --git a/Makefile b/Makefile index 6259b97..bff0edc 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,10 @@ devrun=docker run $(devrunopts) --rm \ -v $(gocache):/root/.cache/go-build \ $(devimage) +## start the service +.PHONY: service +service: + go run cmd/metrica/main.go ## run isolated tests .PHONY: test @@ -40,6 +44,10 @@ dev: devrunopts=-ti dev: dev/image $(devrun) +## run the load test. Obs: you need to run the service before in a different terminal - make service +.PHONY: loadtest +loadtest: k6 run --vus 100 --iterations 10000 loadtest/main.js + ## run a make target inside the dev container. dev/%: dev/image $(devrun) make ${*} diff --git a/README.md b/README.md index 528c739..f1eca22 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,15 @@ To test the code using containers🐋 `make dev/test` & `make dev/lint` +## LoadTest + +The load tests it's using the following rules: + + - 100 concurrent users + - 10000 requests in total + +![image](assets/loadtest.png) + ## Resources Some resources that were useful to solve it diff --git a/assets/loadtest.png b/assets/loadtest.png new file mode 100644 index 0000000..09c4dbe Binary files /dev/null and b/assets/loadtest.png differ diff --git a/loadtest/main.js b/loadtest/main.js new file mode 100644 index 0000000..2d349b2 --- /dev/null +++ b/loadtest/main.js @@ -0,0 +1,6 @@ +// To run just type: k6 run --vus 100 --iterations 10000 integration-tests/main.js +import http from 'k6/http'; + +export default function () { + http.get('http://localhost:8080/countfs'); +}