kaya 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f9d801b48a97d14560149426d8140912a8c7d9f
4
- data.tar.gz: 177c500cad21cb0d3088c22516e499db5b81c29f
3
+ metadata.gz: 83632cfd5b464df4f14544e36b32a9dda02ea83a
4
+ data.tar.gz: f30ca5372f83fad1570ecc442e135578c9899e74
5
5
  SHA512:
6
- metadata.gz: 772acf31863e217ce2df5333f620c9244d1cbec4bafab517384f5dc105595a2e61a11ad23d7d043e3928cb838791973f9bdfaeb018110dc0f0e6136b370148b5
7
- data.tar.gz: fcc29674b853670b1020d905287428479925d1766b04ad57b226d1ae329f31b4587c925e50f3e6e0ee4e2c88cca485e49ba92d03fcc881bc59240edf3ad3d3dd
6
+ metadata.gz: f2aee180b4b8f49fc4e7ad5d089ba9c0530ea584e7dfcf173afffb5dbe2157ed0f7f5f0df17ca38ee0c7a2a488776bcb7f7b138ed40547d6ca9e17f2fb008a4e
7
+ data.tar.gz: 881a684e0676f6a000449f6fa7fd16489288acde990117daad5888019daa6b1057b2229645744fc2f21e228073414946785905d70a4aad34d5f5eb3b0b8ab651
@@ -15,18 +15,25 @@ module Kaya
15
15
  }
16
16
  suites = if options[:running]
17
17
  response["request"] = "Running Suites"
18
- Kaya::Suites.all_running_suites
18
+ Kaya::Suites.running_suites
19
19
  else
20
20
  response["request"] = options[:active] ? "Active Suites" : "Suites"
21
- Kaya::Suites.suite_ids options[:active]
21
+ Kaya::Suites.suites options[:active]
22
22
  end
23
23
 
24
24
 
25
25
  if suites.size.zero?
26
- response["message"] = options[:running] ? "No running suites found" : "No suites found"
26
+ response["message"] = options[:running] ? "Running suites not found" : "Suites not found"
27
27
  else
28
28
  # Gets the executions for given ip
29
- suites = suites.map{|suite_id| Kaya::Suites::Suite.get(suite_id).api_response}
29
+ suites = suites.map do |suite|
30
+ results_for_suite = Kaya::Results.results_ids_for suite["_id"]
31
+ suite["results"]={
32
+ "size" => results_for_suite.size,
33
+ "ids" => results_for_suite
34
+ }
35
+ suite
36
+ end
30
37
 
31
38
  suites = suites.map do |suite|
32
39
  unless Kaya::Results.results_for_suite_id_and_ip(suite["_id"], options[:ip]).empty?
@@ -5,7 +5,7 @@ module Kaya
5
5
 
6
6
  workers_dir = workers_dir = __FILE__.split("/")[0..-2].join("/")+ "/workers"
7
7
 
8
- output = Kaya::Support::Console.execute "sidekiq -r #{workers_dir}/execution_performer.rb -d -L kaya/sidekiq_log -P kaya/sidekiq_pid"
8
+ Kaya::Support::Console.execute "sidekiq -r #{workers_dir}/execution_performer.rb -d -L kaya/sidekiq_log -P kaya/sidekiq_pid"
9
9
 
10
10
  print "\n* Sidekiq:"
11
11
  raise "Could not start Sidekiq correctly. Read kaya/sidekiq_log file for more information" if not started?
@@ -97,7 +97,7 @@ or set HEADLESS active value as false if you do not use browser in your tests."
97
97
 
98
98
  rescue => e
99
99
  $K_LOG.error "Error starting Kaya: #{e}#{e.backtrace}" if $K_LOG
100
- puts "An error ocurred while starting Kaya. See kaya log for more information.".red
100
+ puts "An error ocurred while starting Kaya. See kaya log for more information.#{e} #{e.backtrace}".red
101
101
  end
102
102
  end
103
103
  end
@@ -8,8 +8,7 @@ Cuba.define do
8
8
 
9
9
  request = Kaya::Support::Request.new(req)
10
10
 
11
- $K_LOG.debug "REQUEST '#{request.path}#{request.path_info}' FROM IP: '#{request.ip}'" if $K_LOG
12
-
11
+ $K_LOG.debug "REQUEST '#{request.path}#{request.path_info}' => : '#{request.x_uow}'" if $K_LOG
13
12
  begin
14
13
 
15
14
 
@@ -93,19 +92,16 @@ Cuba.define do
93
92
  on "#{HOSTNAME}/kaya/suites/:suite/run" do |suite_name|
94
93
  query_string = Kaya::Support::QueryString.new req
95
94
  result = Kaya::API::Execution.start suite_name, query_string.values, request.ip
96
-
95
+ suite_name.gsub!("%20"," ")
97
96
  path = "/#{HOSTNAME}/kaya/suites"
98
97
  path += "?msg=#{result['message']}. " if result["message"]
99
98
  path += "Execution id=#{result["execution_id"]}" if result["execution_id"]
100
-
101
99
  res.status= result["status"]
102
100
  res.redirect path
103
101
  end
104
102
 
105
103
  on "#{HOSTNAME}/kaya/suites/:suite_name" do |suite_name|
106
104
  query_string = Kaya::Support::QueryString.new req
107
- (Kaya::Support::Git.reset_hard and Kaya::Support::Git.pull) if Kaya::Support::Configuration.use_git?
108
- Kaya::Suites.update_suites
109
105
  suite_name.gsub!("%20"," ")
110
106
  template = Mote.parse(File.read("#{Kaya::View.path}/body.mote"),self, [:section, :query_string, :suite_name, :log_name, :ip])
111
107
  res.write template.call(section:"Test Suites", query_string:query_string, suite_name:suite_name, log_name:nil, ip:request.ip)
@@ -197,6 +197,10 @@ module Kaya
197
197
  @@suites.find({"active" => true}).to_a
198
198
  end
199
199
 
200
+ def self.running_suites
201
+ @@suites.find({"status" => "RUNNING"}).to_a
202
+ end
203
+
200
204
  def self.active_suites
201
205
  self.suites true
202
206
  end
@@ -33,9 +33,9 @@ module Kaya
33
33
 
34
34
 
35
35
  # data_for_result = {
36
- # :suite_name,
37
- # :execution_name,
38
- # :type:}
36
+ # "suite" => {"name":String, "id":Fixnum},
37
+ # "execution_name" => String
38
+ # "type" => String}
39
39
  def initialize data_for_result
40
40
 
41
41
  if data_for_result["_id"]
@@ -274,16 +274,11 @@ module Kaya
274
274
  $K_LOG.debug "without changes #{self.seconds_without_changes}" if $K_LOG
275
275
  if is_there_console_output_file?
276
276
  begin
277
- output = []
278
- open_console_output_file.each_line do |line|
279
- output << line
280
- end
281
- text = output.join "\n"
282
- if (text.size > @console_output.size )
283
- save_console_output(text)
284
- @last_check_time = now_in_seconds
285
- self.save!
277
+ text = ""
278
+ console_output_content.each_line do |line|
279
+ text += line + "\n"
286
280
  end
281
+ save_console_output(text) if (text.size > @console_output.size)
287
282
  true
288
283
  rescue
289
284
  false
@@ -291,16 +286,11 @@ module Kaya
291
286
  end
292
287
  end
293
288
 
294
-
295
289
  def is_there_console_output_file?
296
- begin
297
- open_console_output_file and true
298
- rescue
299
- false
300
- end
290
+ File.exist? "#{Dir.pwd}/kaya/temp/#{console_output_file_name}"
301
291
  end
302
292
 
303
- def open_console_output_file
293
+ def console_output_content
304
294
  begin
305
295
  FileUtils.cp("#{Dir.pwd}/kaya/temp/#{console_output_file_name}", "#{Dir.pwd}/kaya/temp/#{console_output_file_name}~")
306
296
  file_content = File.open "#{Dir.pwd}/kaya/temp/#{console_output_file_name}~", "r"
@@ -315,6 +305,7 @@ module Kaya
315
305
  # @param [String] text = the text to be appended
316
306
  def append_to_console_output text
317
307
  @console_output += text
308
+ @last_check_time = now_in_seconds
318
309
  self.save!
319
310
  end
320
311
 
@@ -56,7 +56,7 @@ module Kaya
56
56
 
57
57
  def self.update!
58
58
  $K_LOG.debug "Updating suites" if $K_LOG
59
- existing_suites_ids = self.suite_ids
59
+ existing_suites_ids = self.suites.map{|suite| suite["_id"]}
60
60
 
61
61
  self.cucumber_yml.each do |suite_data|
62
62
  # If is there a suite for the given name suite_id will be setted
@@ -94,11 +94,9 @@ module Kaya
94
94
  # Returns a list of suites id
95
95
  # @param [Boolean] actives or not
96
96
  # @return [Array] a list of suite ids
97
- def self.suite_ids active=nil
97
+ def self.suites active=nil
98
98
  $K_LOG.debug "Suites:Getting all suites ids" if $K_LOG
99
- Kaya::Database::MongoConnector.suites(active).map do |suite_data|
100
- suite_data["_id"]
101
- end
99
+ Kaya::Database::MongoConnector.suites(active)
102
100
  end
103
101
 
104
102
  # Returns the id for given suite name
@@ -111,17 +109,18 @@ module Kaya
111
109
 
112
110
  # Returns the ids for running suites
113
111
  # @return [Array] of suite ids
114
- def self.all_running_suites
112
+ def self.running_suites
115
113
  $K_LOG.debug "Suites: Getting all runnnig suites" if $K_LOG
116
- Kaya::Database::MongoConnector.all_suites.select do |suite|
117
- suite["status"] == "RUNNING"
118
- end.map{|suite| suite["_id"]}
114
+ # Kaya::Database::MongoConnector.all_suites.select do |suite|
115
+ # suite["status"] == "RUNNING"
116
+ # end.map{|suite| suite["_id"]}
117
+ Kaya::Database::MongoConnector.running_suites
119
118
  end
120
119
 
121
120
  def self.reset_statuses
122
121
  $K_LOG.debug "Resetting suites status" if $K_LOG
123
- self.all_running_suites.each do |suite_id|
124
- if suite = Kaya::Suites::Suite.get(suite_id)
122
+ self.running_suites.each do |suite|
123
+ if suite = Kaya::Suites::Suite.get(suite["_id"])
125
124
  if result = Kaya::Results::Result.get(suite.last_result)
126
125
  result.update_values! # update_values! true means result got finished status
127
126
  end
@@ -18,6 +18,10 @@ module Kaya
18
18
  @req.env["REMOTE_ADDR"]
19
19
  end
20
20
 
21
+ def x_uow
22
+ @req.env["HTTP_X_UOW"]
23
+ end
24
+
21
25
  def method_missing(method_name, *args, &block)
22
26
  begin
23
27
  send("@req.#{method_name}", *args)
@@ -1,3 +1,3 @@
1
1
  module Kaya
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -8,7 +8,7 @@
8
8
  $('#myModal').modal('show');
9
9
  }
10
10
 
11
- function startedAlert(title, text){
11
+ function startedAlert(title, text, suiteName){
12
12
  startedInfo(title,text);
13
13
  url = 'http://' + window.location.host + window.location.pathname;
14
14
  $('#startedModal').modal('show');
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Rodriguez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-07 00:00:00.000000000 Z
11
+ date: 2015-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor