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 +4 -4
- data/lib/kaya/API/suites.rb +11 -4
- data/lib/kaya/background_jobs/sidekiq.rb +1 -1
- data/lib/kaya/commands/start.rb +1 -1
- data/lib/kaya/cuba.rb +2 -6
- data/lib/kaya/database/mongo_connector.rb +4 -0
- data/lib/kaya/results/result.rb +10 -19
- data/lib/kaya/suites/suites.rb +10 -11
- data/lib/kaya/support/request.rb +4 -0
- data/lib/kaya/version.rb +1 -1
- data/lib/kaya/view/javascript.mote +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83632cfd5b464df4f14544e36b32a9dda02ea83a
|
4
|
+
data.tar.gz: f30ca5372f83fad1570ecc442e135578c9899e74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2aee180b4b8f49fc4e7ad5d089ba9c0530ea584e7dfcf173afffb5dbe2157ed0f7f5f0df17ca38ee0c7a2a488776bcb7f7b138ed40547d6ca9e17f2fb008a4e
|
7
|
+
data.tar.gz: 881a684e0676f6a000449f6fa7fd16489288acde990117daad5888019daa6b1057b2229645744fc2f21e228073414946785905d70a4aad34d5f5eb3b0b8ab651
|
data/lib/kaya/API/suites.rb
CHANGED
@@ -15,18 +15,25 @@ module Kaya
|
|
15
15
|
}
|
16
16
|
suites = if options[:running]
|
17
17
|
response["request"] = "Running Suites"
|
18
|
-
Kaya::Suites.
|
18
|
+
Kaya::Suites.running_suites
|
19
19
|
else
|
20
20
|
response["request"] = options[:active] ? "Active Suites" : "Suites"
|
21
|
-
Kaya::Suites.
|
21
|
+
Kaya::Suites.suites options[:active]
|
22
22
|
end
|
23
23
|
|
24
24
|
|
25
25
|
if suites.size.zero?
|
26
|
-
response["message"] = options[:running] ? "
|
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
|
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
|
-
|
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?
|
data/lib/kaya/commands/start.rb
CHANGED
@@ -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
|
data/lib/kaya/cuba.rb
CHANGED
@@ -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}'
|
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)
|
data/lib/kaya/results/result.rb
CHANGED
@@ -33,9 +33,9 @@ module Kaya
|
|
33
33
|
|
34
34
|
|
35
35
|
# data_for_result = {
|
36
|
-
# :
|
37
|
-
#
|
38
|
-
#
|
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
|
-
|
278
|
-
|
279
|
-
|
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
|
-
|
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
|
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
|
|
data/lib/kaya/suites/suites.rb
CHANGED
@@ -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.
|
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.
|
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)
|
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.
|
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
|
-
|
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.
|
124
|
-
if suite = Kaya::Suites::Suite.get(
|
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
|
data/lib/kaya/support/request.rb
CHANGED
data/lib/kaya/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|