Skip to content

tlopo-ruby/svcdeps_tasks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RSpec tests for Service Dependencies

USAGE

  1. Install the gem
gem install svcdeps_tasks
  1. Add the following to Rakefile:
require 'svcdeps_tasks'

ENV['SVCDEPS_PATH'] = '/etc/svcdeps'
  1. Create a directory for dependencies manifests, /ec/svcdeps in our case:
mkdir /etc/svcdeps
  1. Create dependencies manifests, which are yaml files describing how to check the service dependencies:
deps: 
  - type: tcp
    host: www.google.com
    port: 80
    timeout: 2
    desc: Should be able to tcp port ping www.google.com:80
    
  - type: udp
    host: 8.8.8.8
    port: 53
    timeout: 2
    desc: Should be able to udp port ping DNS server(8.8.8.8:53)

  - type: http
    method: get
    url: https://www.google.com
    insecure: false
    timeout: 2
    desc: Should be able to hit https://www.google.com
    
  - type: command
    command: ping -c 1 8.8.8.8
    timeout: 2 
    desc: Should be able to ping 8.8.8.8
  1. Run:
# rake spec:svcdeps

Service Dependencies
  Should be able to tcp port ping www.google.com:80
  Should be able to udp port ping DNS server(8.8.8.8:53)
  Should be able to hit https://www.google.com
  Should be able to ping 8.8.8.8

Finished in 0.16224 seconds (files took 0.28904 seconds to load)
4 examples, 0 failures