Added support of ES_INDEX_RAND.
This commit is contained in:
parent
adc801c6d1
commit
b2bfeff55a
1 changed files with 10 additions and 4 deletions
|
@ -11,6 +11,9 @@ class ReportTest < ActiveSupport::TestCase
|
||||||
if !ENV['ES_INDEX']
|
if !ENV['ES_INDEX']
|
||||||
fail "ERROR: Need ES_INDEX - hint ES_INDEX='estest.local_zammad'"
|
fail "ERROR: Need ES_INDEX - hint ES_INDEX='estest.local_zammad'"
|
||||||
end
|
end
|
||||||
|
if ENV['ES_INDEX_RAND']
|
||||||
|
ENV['ES_INDEX'] = "es_index_#{rand(999_999_999)}"
|
||||||
|
end
|
||||||
Setting.set('es_index', ENV['ES_INDEX'])
|
Setting.set('es_index', ENV['ES_INDEX'])
|
||||||
|
|
||||||
# Setting.set('es_url', 'http://172.0.0.1:9200')
|
# Setting.set('es_url', 'http://172.0.0.1:9200')
|
||||||
|
@ -242,7 +245,7 @@ class ReportTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
sleep 6
|
sleep 6
|
||||||
|
|
||||||
test 'first solution' do
|
test 'a - first solution' do
|
||||||
|
|
||||||
# month
|
# month
|
||||||
result = Report::TicketFirstSolution.aggs(
|
result = Report::TicketFirstSolution.aggs(
|
||||||
|
@ -488,7 +491,7 @@ class ReportTest < ActiveSupport::TestCase
|
||||||
# created by channel and direction
|
# created by channel and direction
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'reopen' do
|
test 'b - reopen' do
|
||||||
|
|
||||||
# month
|
# month
|
||||||
result = Report::TicketReopened.aggs(
|
result = Report::TicketReopened.aggs(
|
||||||
|
@ -604,7 +607,7 @@ class ReportTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'move in/out' do
|
test 'c - move in/out' do
|
||||||
|
|
||||||
# month
|
# month
|
||||||
result = Report::TicketMoved.aggs(
|
result = Report::TicketMoved.aggs(
|
||||||
|
@ -702,7 +705,7 @@ class ReportTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'created at' do
|
test 'd - created at' do
|
||||||
|
|
||||||
# month
|
# month
|
||||||
result = Report::TicketGenericTime.aggs(
|
result = Report::TicketGenericTime.aggs(
|
||||||
|
@ -742,6 +745,9 @@ class ReportTest < ActiveSupport::TestCase
|
||||||
assert_equal(ticket2.id, result[:ticket_ids][5].to_i)
|
assert_equal(ticket2.id, result[:ticket_ids][5].to_i)
|
||||||
assert_equal(ticket1.id, result[:ticket_ids][6].to_i)
|
assert_equal(ticket1.id, result[:ticket_ids][6].to_i)
|
||||||
assert_equal(nil, result[:ticket_ids][7])
|
assert_equal(nil, result[:ticket_ids][7])
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
system('rake searchindex:drop')
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue