Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ feat:loadtest #6

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
}
Loading