Crates.io | fakesite |
lib.rs | fakesite |
version | 0.1.8-1eada16 |
source | src |
created_at | 2020-01-05 15:58:13.77277 |
updated_at | 2020-02-01 19:26:16.360957 |
description | fakesite simulates a website with a random behavior. It can be used for load testing web monitors. |
homepage | https://gitlab.com/ufoot/fakesite |
repository | https://gitlab.com/ufoot/fakesite/tree/master |
max_upload_size | |
id | 195431 |
size | 80,227 |
Fakesite simulates a website with a random behavior. It can be used for load testing web monitors.
It is written in Rust and is mostly a toy project to ramp up on the language. It might however be useful. Use at your own risk.
Current version is 0.1.8.
No install target yet, copy the fakesite
binary in your $PATH
if you wish, that's all.
A few commands which may prove useful:
cargo build # build debug binary in ./target/debug/
cargo build --release # build release binary in ./target/release/
cargo test # launch tests
rustfmt src/*.rs # format code
./docker-build.sh # build Docker image with version tag
./bump-version.sh # bump minor version number
Simply launch:
cargo run
Or just run the binary directly:
./target/debug/fakesite
./target/release/fakesite
Alternatively, using docker:
docker run -p 8080:80 ufoot/fakesite
To pass options:
cargo run -- :8090
By default, the server listens on all interfaces on port 8080.
To change the port the program listens to, pass :<port>
eg :8090
to listen on port 8090. Eg:
fakesite :8090
Other standard options include:
-h
, --help
: display a short help.-v
, --version
: display version.The responses, especially the error codes, may look random, but they follow fixed patterns:
A typical output from the program could be:
# [04/Dec/2019:21:06:46 +0000] start HTTP server listening on 127.0.0.1:8080
127.0.0.1 - - [04/Dec/2019:21:06:46 +0000] "GET / HTTP/1.0" 302 0
127.0.0.1 - - [04/Dec/2019:21:06:47 +0000] "GET / HTTP/1.0" 302 0
127.0.0.1 - - [04/Dec/2019:21:06:48 +0000] "GET / HTTP/1.0" 200 51
127.0.0.1 - - [04/Dec/2019:21:06:49 +0000] "GET / HTTP/1.0" 302 0
127.0.0.1 - - [04/Dec/2019:21:06:49 +0000] "GET / HTTP/1.0" 302 0
127.0.0.1 - - [04/Dec/2019:21:06:50 +0000] "GET / HTTP/1.0" 200 51
127.0.0.1 - - [04/Dec/2019:21:06:51 +0000] "GET / HTTP/1.0" 500 31
127.0.0.1 - - [04/Dec/2019:21:07:14 +0000] "GET / HTTP/1.0" 404 28
127.0.0.1 - - [04/Dec/2019:21:07:15 +0000] "GET / HTTP/1.0" 200 51
127.0.0.1 - - [04/Dec/2019:21:07:16 +0000] "GET / HTTP/1.0" 404 28
# [04/Dec/2019:21:07:16 +0000] switch to ERR mode (lots of 500s)
127.0.0.1 - - [04/Dec/2019:21:07:16 +0000] "GET / HTTP/1.0" 500 31
127.0.0.1 - - [04/Dec/2019:21:07:17 +0000] "GET / HTTP/1.0" 500 31
Fakesite is licensed under the MIT license.