Sha256: 9fa4f10b3c81f265cb02a88e62c667bf61a7c99cca4e3b19c248440f3cf42803

Contents?: true

Size: 1.48 KB

Versions: 5

Compression:

Stored size: 1.48 KB

Contents

#!/usr/bin/ruby

require_relative "../lib/httpotemkin"

containers = Httpotemkin::Containers.new
containers.add_server("rubygems")
containers.add_server("api.rubygems")
containers.add_server("obs")

cmd = ARGV[0]

if cmd == "version"
  puts Httpotemkin::VERSION
elsif cmd == "status"
  containers.print_status
elsif cmd == "up"
  puts "Starting server containers"
  containers.up
elsif cmd == "down"
  puts "Stopping server containers"
  containers.down
elsif cmd == "client"
  puts containers.run_client
elsif cmd == "run"
  puts "Running tests"

  expected_output = File.read("expected_output")

  containers.up
  sleep 3 unless ENV["RUN_BY_RSPEC"]

  actual_output = containers.run_client

  puts "--- Start Test ---"
  puts actual_output
  puts "---- End Test ----"

  containers.down(save_logs: true)

  puts
  if actual_output == expected_output
    puts "Success."
  else
    puts "Failed."
    puts
    puts "Expected output:"
    puts expected_output
    puts
    puts "Actual output:"
    puts actual_output
    exit 1
  end
else
  if !cmd
    STDERR.puts "You need to provide a command"
  elsif cmd != "help"
    puts "Unknown command: #{cmd}"
  end

  puts "Usage: httpotemkin <command>"
  puts
  puts "Testing with HTTP mocks based on containers"
  puts
  puts "Commands:"
  puts "  status  - Show status of containers"
  puts "  up      - Start containers"
  puts "  down    - Stop containters"
  puts "  client  - Run client"
  puts "  run     - Run tests"
  puts "  help    - Show command line help"
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
httpotemkin-0.0.6 bin/httpotemkin
httpotemkin-0.0.5 bin/httpotemkin
httpotemkin-0.0.4 bin/httpotemkin
httpotemkin-0.0.3 bin/httpotemkin
httpotemkin-0.0.2 bin/httpotemkin