Sha256: 6fb676ef03c1729bcc7d11048c3513d70947b6db8e9365c6f50e4a48404b45fe

Contents?: true

Size: 701 Bytes

Versions: 7

Compression:

Stored size: 701 Bytes

Contents

# frozen_string_literal: true

module NoradCli
  class ResultsServer
    attr_accessor :container

    def initialize(test_results_server_image)
      @container = Docker::Container.create(
        Image: test_results_server_image,
        HostConfig: { PublishAllPorts: true }
      )
    end

    def start
      @container.start
      sleep 5 # sleep rather than wait since we are daemonizing a containe
      refresh
    end

    def refresh
      @container.refresh! # get more details
    end

    def shutdown
      @container.stop
      @container.delete(force: true)
    end

    def host_port
      @container.info['NetworkSettings']['Ports']['3000/tcp'].first['HostPort']
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
norad_cli-0.2.5 lib/norad_cli/support/results_server.rb
norad_cli-0.2.4 lib/norad_cli/support/results_server.rb
norad_cli-0.2.3 lib/norad_cli/support/results_server.rb
norad_cli-0.2.2 lib/norad_cli/support/results_server.rb
norad_cli-0.2.1 lib/norad_cli/support/results_server.rb
norad_cli-0.2.0 lib/norad_cli/support/results_server.rb
norad_cli-0.1.24 lib/norad_cli/support/results_server.rb