Skip to content

Commit

Permalink
Merge pull request #6 from perebaj/loadtest
Browse files Browse the repository at this point in the history
✨ feat:loadtest
  • Loading branch information
perebaj authored Oct 12, 2023
2 parents dd30eb6 + be4b5a1 commit 58e84ca
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ${*}
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file added assets/loadtest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions loadtest/main.js
Original file line number Diff line number Diff line change
@@ -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');
}

0 comments on commit 58e84ca

Please sign in to comment.