Class: AppTest

Inherits:
Object
  • Object
show all
Defined in:
lib/test/app_test.rb

Instance Method Summary collapse

Instance Method Details

#clientObject



46
47
48
# File 'lib/test/app_test.rb', line 46

def client()
  @client ||= JFoundry::V2::Client.new("http://api.bw-jd-app.com","3e05c77d08a14045a0bd2ea307eb1ae9","6212b165e5b54c3cb43d20295bf03e7aPIymHVqg","2","Dashboard")
end

#stream_start_log_test(log) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/test/app_test.rb', line 17

def stream_start_log_test(log)
  offset =0
  while true
      begin
        client.stream_url(log + "&tail&tail_offset=#{offset}") do |out|
          offset += out.size
          puts "###########out:#{out}"
        end
      rescue Timeout::Error=>ex
         puts "info","tail app stagin log error,ex:#{ex.message}"
      end
  end
  rescue JFoundry::APIError=>ex
     puts "info","tail app stagin log error,ex:#{ex.message}"
end

#test_deployObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/test/app_test.rb', line 5

def test_deploy()
  app = client.apps_by_name("php_log_test").first
  log = nil
  app.deploy("/export/home/jfoundry/testapp/jae_php0014",false) do |url|
    puts "------------>#{url}"
    log = url
  end
  if log
    stream_start_log_test(log)
  end
end

#test_restartObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/test/app_test.rb', line 33

def test_restart()
  app = client.apps_by_name("php_restart").first
  response = app.restart
  
  while true
    instances = app.instances
    instances.each do |instance|
      puts "state:#{instance.state},remark:#{instance.remark}"
    end
  end
  puts "--------#{response}"
end