tac-cli 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,18 +17,18 @@ module CTT::Cli
17
17
  collect
18
18
 
19
19
  payload = @info.dup
20
- payload[:results_file] = @tar_file
21
- payload[:multipart] = true
20
+ payload[:file] = File.open(@tar_file_path, "r")
21
+ payload[:multipart] = true
22
22
 
23
23
  #retry 3 times
24
24
  3.times do
25
25
  begin
26
26
  response = RestClient.post("#{RESULTS_SERVER_URL}/tac/upload", payload)
27
+ break if response.code == 200
27
28
  rescue
28
29
  end
29
- break if (response.nil? || response.code == 200)
30
30
  end
31
- @tar_file.unlink
31
+ FileUtils.rm(payload[:file].path)
32
32
  end
33
33
 
34
34
  def collect
@@ -87,20 +87,23 @@ module CTT::Cli
87
87
  say("report path did not exists. abort!", :red)
88
88
  exit(1)
89
89
  end
90
- @tar_file = zip_test_reports(report_path)
90
+ @tar_file_path = zip_test_reports(report_path)
91
91
  end
92
92
 
93
93
  def zip_test_reports(reports_path)
94
- tar_file = Tempfile.new(%w(reports .tgz))
95
- `tar czf #{tar_file.path} #{reports_path} 2>&1`
94
+
95
+ temp_file_path = File.join(Dir.tmpdir, "reports-#{@uuid}.tgz")
96
+ pwd = Dir.pwd
97
+ Dir.chdir(File.dirname(reports_path))
98
+ `tar czf #{temp_file_path} #{File.basename(reports_path)} 2>&1`
96
99
  unless $?.exitstatus == 0
97
100
  say("fail to tarball test reports. abort!", :red)
98
- tar_file.unlink
101
+ FileUtils.rm(temp_file_path)
99
102
  exit(1)
100
103
  end
101
- tar_file
102
- end
103
-
104
+ Dir.chdir(pwd)
104
105
 
106
+ temp_file_path
107
+ end
105
108
  end
106
109
  end
@@ -3,6 +3,6 @@ module CTT::Cli
3
3
 
4
4
  TEST_SUITE_CONFIG_FILE = "tac.yml"
5
5
  TEST_RESULT_FILE = "junitResult.xml"
6
- RESULTS_SERVER_URL = "http://127.0.0.1:4567"
6
+ RESULTS_SERVER_URL = "http://giant.cloudfoundry.com"
7
7
 
8
8
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  module CTT
3
3
  module Cli
4
- VERSION = '0.0.9'
4
+ VERSION = '0.1.0'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tac-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-06 00:00:00.000000000Z
12
+ date: 2012-12-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json_pure