acceptance/lib/pxp-agent/test_helper.rb
# Some helpers for working with a pcp-broker 'lein tk' instance
Some helpers for working with a pcp-broker 'lein tk' instance
Some helpers for working with a pcp - broker ' lein tk ' instance
def run_pcp_broker(host, instance=0)
  timeout = 120
  host[:pcp_broker_instance] = instance
  lein_command = "cd #{GIT_CLONE_FOLDER}/pcp-broker#{instance}; export LEIN_ROOT=ok; \
     lein with-profile #{LEIN_PROFILE} tk </dev/null >/var/log/puppetlabs/pcp-broker.log.#{SecureRandom.uuid} 2>&1 &"
  jvm_opts = ['-Djdk.tls.ephemeralDHKeySize=2048']
  jvm_opts << '-Xms2g -Xmx2g' if host[:gke_container]
  lein_command = "export JVM_OPTS='#{jvm_opts.join(' ')}'; export LEIN_JVM_OPTS='#{jvm_opts.join(' ')}'; #{lein_command}"
  on(host, lein_command)
  assert(port_open_within?(host, PCP_BROKER_PORTS[instance], timeout),
         "pcp-broker port #{PCP_BROKER_PORTS[instance].to_s} not open within #{(timeout/60).to_s} minutes of starting the broker")
  broker_state = nil
  attempts = 0
  until broker_state == "running" or attempts == 100 do
    broker_state = get_pcp_broker_status(host)
    if broker_state != "running"
      attempts += 1
      sleep 0.5
    end
  end
  assert_equal("running", broker_state, "Shortly after startup, pcp-broker should report its state as being 'running'")
end
def run_pcp_broker ( host , instance = 0 ) timeout = 120 host [ :pcp_broker_instance ] = instance lein_command = "cd #{GIT_CLONE_FOLDER}/pcp-broker#{instance}; export LEIN_ROOT=ok; \
     lein with-profile #{LEIN_PROFILE} tk </dev/null >/var/log/puppetlabs/pcp-broker.log.#{SecureRandom.uuid} 2>&1 &" jvm_opts = [ '-Djdk.tls.ephemeralDHKeySize=2048' ] jvm_opts << '-Xms2g -Xmx2g' if host [ :gke_container ] lein_command = "export JVM_OPTS='#{jvm_opts.join(' ')}'; export LEIN_JVM_OPTS='#{jvm_opts.join(' ')}'; #{lein_command}" on ( host , lein_command ) assert ( port_open_within? ( host , PCP_BROKER_PORTS [ instance ] , timeout ) , "pcp-broker port #{PCP_BROKER_PORTS[instance].to_s} not open within #{(timeout/60).to_s} minutes of starting the broker" ) broker_state = nil attempts = 0 until broker_state == "running" or attempts == 100 do broker_state = get_pcp_broker_status ( host ) if broker_state != "running" attempts += 1 sleep 0.5 end end assert_equal ( "running" , broker_state , "Shortly after startup, pcp-broker should report its state as being 'running'" ) end
Some helpers for working with a pcp-broker 'lein tk' instance
Some helpers for working with a pcp - broker ' lein tk ' instance
host
<not_specific>
instance
<not_specific>