Giter Site home page Giter Site logo

http-healthcheck's Introduction

HTTP-Healthcheck

Test assignment at the interview at IT Solutions Management International Pte. Ltd.

Задача

Необходимо разработать CLI-утилиту совершающую HTTP Healthcheck'и по заданному URL'у.

Проверка совершается в цикле с заданным интервалом. На каждой итерации необходимо совершить HTTP GET по заданному URL'у. Есть три возможных результата проверки:

  1. OK(200), в случае, если запрос вернул HTTP status code 200.
  2. ERR({HTTP_CODE}), в случае, если запрос вернул HTTP status code отличный от 200.
  3. URL parsing error, в случае, если второй аргумент не является валидным HTTP URL'ом. После чего приложение завершается.

Утилита принимает два аргумента:

  1. Целочисленное значение интервала в секундах.
  2. HTTP URL который будет проверяться.

Примеры выполнения:

~$./my_binary 2 http://example.com/
 
Checking 'http://example.com/'. Result: OK(200)
Checking 'http://example.com/'. Result: OK(200)
Checking 'http://example.com/'. Result: OK(200)
^C
~$./my_binary 1 http://httpstat.us/500
 
Checking 'http://httpstat.us/500'. Result: ERR(500)
Checking 'http://httpstat.us/500'. Result: ERR(500)
^C
~$./my_binary 1 http://httpstat.us/503
 
Checking 'http://httpstat.us/503'. Result: ERR(503)
Checking 'http://httpstat.us/503'. Result: ERR(503)
^C
~$./my_binary 1 this_is_not_an_url
 
URL parsing error

http-healthcheck's People

Contributors

katletos avatar

Watchers

 avatar

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.