Skip to content

Commit d92503c

Browse files
committed
add file to create db and insert test data
1 parent 8ff2473 commit d92503c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/insert_data.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
require './lib/es_client'
2+
3+
esclient = ESClient.new("localhost:9200")
4+
5+
# create database
6+
begin
7+
esclient.delete_indices('exceptionist')
8+
rescue Elasticsearch::Transport::Transport::Errors::NotFound
9+
end
10+
11+
esclient.create_indices('exceptionist',
12+
{ mappings: {
13+
occurrences: { properties: {
14+
action_name: { type: 'string', index: 'not_analyzed' },
15+
controller_name: { type: 'string', index: 'not_analyzed' },
16+
project_name: { type: 'string', index: 'not_analyzed' },
17+
uber_key: { type: 'string', index: 'not_analyzed' },
18+
exception_class: { type: 'string', index: 'not_analyzed' },
19+
} },
20+
exceptions:{ properties: {
21+
project_name: { type: 'string', index: 'not_analyzed' },
22+
} }
23+
} })
24+
esclient.refresh
25+
26+
5.times { `curl -X POST -d @test/fixtures/full_exception.xml http://localhost:9292/notifier_api/v2/notices/?` }
27+
28+
esclient.refresh
29+

0 commit comments

Comments
 (0)