Fakesite

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.

Fakesite icon

Status

Build Status

Current version is 0.1.7.

Install

No install target yet, copy the fakesite binary in your $PATH if you wish, that's all.

A few commands which may prove useful:

sh 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

Usage

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:

Responses content

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 ```

Legal information

Fakesite is licensed under the MIT license.