Code Monkey home page Code Monkey logo

timeout's Introduction

Timeout

Build Status Coverage Status Heroku

timeout is written to satisfy tcp and http based timeout testing needs. It works as a stub server in replacement of your application's external tcp/http dependency.

Briefly speaking, you can run a tcp/http stub server in seconds.


HTTP

  • Respond with status http:yourhost/yourresource?status=x where x is an integer number between 200 and 599:

    • https://gotimeout.herokuapp.com/yourpreciousresource?status=201
    • https://gotimeout.herokuapp.com/yourpreciousresource?status=302
    • https://gotimeout.herokuapp.com/yourpreciousresource?status=401
  • Sleep before responding http:yourhost/yourresource?sleep=x x is in milliseconds:

    • https://gotimeout.herokuapp.com/yourpreciousresource?sleep=1000 --> wait for 1 second before responding
    • https://gotimeout.herokuapp.com/yourpreciousresource?sleep=5000 --> wait for 5 second before responding

TCP

  • Listen but do not respond, from port :5501
  • Listen and respond with empty string, from port :5502
  • Listen and respond with empty string after client sends data, :5503
  • Listen and respond with malformed string, from port :5504
  • Listen and respond with malformed string after client sends data, from port :5505
  • Listen and respond with empty string every 5 seconds, from port :5506
  • Listen and respond with empty string every 30 seconds, from port :5507

Install

go get github.com/yaman/timeout


Run

$GOPATH/bin/timeout -proto=http -port=8080

$GOPATH/bin/timeout -proto=tcp


Directly use it from Heroku

Only Http timeout is available through heroku for now. Just change your external url to ;

https://gotimeout.herokuapp.com/yourpreciousresource?sleep=1


Run with Docker prebuild image

You just need to run following command provided that Docker is up and running on your local machine;

for http and exposing port 5000

sudo docker run -p 5000:5000 -e PROTO=http -e PORT=5000 yaman/timeout

for tcp

sudo docker run -p 5500-5600:5500-5600 -e PROTO=tcp yaman/timeout


timeout's People

Contributors

mjeri avatar yaman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mjeri

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.