instana 1.10.8-java → 1.10.9-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,134 +0,0 @@
1
- require 'test_helper'
2
- require 'active_record'
3
-
4
- class ActiveRecordPgTest < Minitest::Test
5
- def test_config_defaults
6
- assert ::Instana.config[:active_record].is_a?(Hash)
7
- assert ::Instana.config[:active_record].key?(:enabled)
8
- assert_equal true, ::Instana.config[:active_record][:enabled]
9
- end
10
-
11
- def test_postgresql
12
- # Make one call to warm up the Rails stack and allow it to load
13
- # relations
14
- Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
15
-
16
- skip unless ::Instana::Test.postgresql?
17
-
18
- clear_all!
19
-
20
- Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
21
-
22
- traces = Instana.processor.queued_traces
23
- assert_equal 1, traces.length
24
- trace = traces.first
25
-
26
- assert_equal 6, trace.spans.length
27
- spans = trace.spans.to_a
28
- first_span = spans[0]
29
- second_span = spans[2]
30
- third_span = spans[3]
31
- fourth_span = spans[4]
32
-
33
- assert_equal :rack, first_span.name
34
- assert_equal :activerecord, second_span.name
35
- assert_equal :activerecord, third_span.name
36
- assert_equal :activerecord, fourth_span.name
37
-
38
- assert_equal "INSERT INTO \"blocks\" (\"name\", \"color\", \"created_at\", \"updated_at\") VALUES ($?, $?, $?, $?) RETURNING \"id\"", second_span[:data][:activerecord][:sql]
39
- assert_equal "SELECT \"blocks\".* FROM \"blocks\" WHERE \"blocks\".\"name\" = $? ORDER BY \"blocks\".\"id\" ASC LIMIT ?", third_span[:data][:activerecord][:sql]
40
- assert_equal "DELETE FROM \"blocks\" WHERE \"blocks\".\"id\" = $?", fourth_span[:data][:activerecord][:sql]
41
-
42
- assert_equal "postgresql", second_span[:data][:activerecord][:adapter]
43
- assert_equal "postgresql", third_span[:data][:activerecord][:adapter]
44
- assert_equal "postgresql", fourth_span[:data][:activerecord][:adapter]
45
-
46
- assert_equal ENV['TRAVIS_PSQL_HOST'], second_span[:data][:activerecord][:host]
47
- assert_equal ENV['TRAVIS_PSQL_HOST'], third_span[:data][:activerecord][:host]
48
- assert_equal ENV['TRAVIS_PSQL_HOST'], fourth_span[:data][:activerecord][:host]
49
-
50
- assert_equal "postgres", second_span[:data][:activerecord][:username]
51
- assert_equal "postgres", third_span[:data][:activerecord][:username]
52
- assert_equal "postgres", fourth_span[:data][:activerecord][:username]
53
- end
54
-
55
- def test_mysql2
56
- skip unless ::Instana::Test.mysql2?
57
-
58
- clear_all!
59
-
60
- Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
61
-
62
- traces = Instana.processor.queued_traces
63
- assert_equal 1, traces.length
64
- trace = traces.first
65
-
66
- assert_equal 6, trace.spans.length
67
- spans = trace.spans.to_a
68
- first_span = spans[0]
69
- second_span = spans[2]
70
- third_span = spans[3]
71
- fourth_span = spans[4]
72
-
73
- assert_equal :rack, first_span.name
74
- assert_equal :activerecord, second_span.name
75
- assert_equal :activerecord, third_span.name
76
- assert_equal :activerecord, fourth_span.name
77
-
78
- assert_equal "INSERT INTO `blocks` (`name`, `color`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?)", second_span[:data][:activerecord][:sql]
79
- assert_equal "SELECT `blocks`.* FROM `blocks` WHERE `blocks`.`name` = ? ORDER BY `blocks`.`id` ASC LIMIT ?", third_span[:data][:activerecord][:sql]
80
- assert_equal "DELETE FROM `blocks` WHERE `blocks`.`id` = ?", fourth_span[:data][:activerecord][:sql]
81
-
82
- assert_equal "mysql2", second_span[:data][:activerecord][:adapter]
83
- assert_equal "mysql2", third_span[:data][:activerecord][:adapter]
84
- assert_equal "mysql2", fourth_span[:data][:activerecord][:adapter]
85
-
86
- assert_equal ENV['TRAVIS_MYSQL_HOST'], second_span[:data][:activerecord][:host]
87
- assert_equal ENV['TRAVIS_MYSQL_HOST'], third_span[:data][:activerecord][:host]
88
- assert_equal ENV['TRAVIS_MYSQL_HOST'], fourth_span[:data][:activerecord][:host]
89
-
90
- assert_equal ENV['TRAVIS_MYSQL_USER'], second_span[:data][:activerecord][:username]
91
- assert_equal ENV['TRAVIS_MYSQL_USER'], third_span[:data][:activerecord][:username]
92
- assert_equal ENV['TRAVIS_MYSQL_USER'], fourth_span[:data][:activerecord][:username]
93
- end
94
-
95
- def test_mysql
96
- skip unless ::Instana::Test.mysql?
97
-
98
- clear_all!
99
-
100
- Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
101
-
102
- traces = Instana.processor.queued_traces
103
- assert_equal 1, traces.length
104
- trace = traces.first
105
-
106
- assert_equal 6, trace.spans.length
107
- spans = trace.spans.to_a
108
- first_span = spans[0]
109
- second_span = spans[2]
110
- third_span = spans[3]
111
- fourth_span = spans[4]
112
-
113
- assert_equal :rack, first_span.name
114
- assert_equal :activerecord, second_span.name
115
- assert_equal :activerecord, third_span.name
116
- assert_equal :activerecord, fourth_span.name
117
-
118
- assert_equal "INSERT INTO `blocks` (`name`, `color`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?)", second_span[:data][:activerecord][:sql]
119
- assert_equal "SELECT `blocks`.* FROM `blocks` WHERE `blocks`.`name` = ? ORDER BY `blocks`.`id` ASC LIMIT ?", third_span[:data][:activerecord][:sql]
120
- assert_equal "DELETE FROM `blocks` WHERE `blocks`.`id` = ?", fourth_span[:data][:activerecord][:sql]
121
-
122
- assert_equal "mysql", second_span[:data][:activerecord][:adapter]
123
- assert_equal "mysql", third_span[:data][:activerecord][:adapter]
124
- assert_equal "mysql", fourth_span[:data][:activerecord][:adapter]
125
-
126
- assert_equal ENV['TRAVIS_MYSQL_HOST'], second_span[:data][:activerecord][:host]
127
- assert_equal ENV['TRAVIS_MYSQL_HOST'], third_span[:data][:activerecord][:host]
128
- assert_equal ENV['TRAVIS_MYSQL_HOST'], fourth_span[:data][:activerecord][:host]
129
-
130
- assert_equal ENV['TRAVIS_MYSQL_USER'], second_span[:data][:activerecord][:username]
131
- assert_equal ENV['TRAVIS_MYSQL_USER'], third_span[:data][:activerecord][:username]
132
- assert_equal ENV['TRAVIS_MYSQL_USER'], fourth_span[:data][:activerecord][:username]
133
- end
134
- end
@@ -1,87 +0,0 @@
1
- require 'test_helper'
2
- require 'active_record'
3
-
4
- class ActiveRecordTest < Minitest::Test
5
- def test_config_defaults
6
- assert ::Instana.config[:active_record].is_a?(Hash)
7
- assert ::Instana.config[:active_record].key?(:enabled)
8
- assert_equal true, ::Instana.config[:active_record][:enabled]
9
- end
10
-
11
- def test_postgresql
12
- skip unless ::Instana::Test.postgresql?
13
-
14
- clear_all!
15
-
16
- Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
17
-
18
- traces = Instana.processor.queued_traces
19
- assert_equal 1, traces.length
20
- trace = traces.first
21
-
22
- assert_equal 6, trace.spans.length
23
- spans = trace.spans.to_a
24
- first_span = spans[0]
25
- second_span = spans[2]
26
- third_span = spans[3]
27
- fourth_span = spans[4]
28
-
29
- assert_equal :rack, first_span[:n]
30
- assert_equal :activerecord, second_span[:n]
31
- assert_equal :activerecord, third_span[:n]
32
- assert_equal :activerecord, fourth_span[:n]
33
-
34
- assert_equal "INSERT INTO \"blocks\" (\"name\", \"color\", \"created_at\", \"updated_at\") VALUES ($?, $?, $?, $?) RETURNING \"id\"", second_span[:data][:activerecord][:sql]
35
- assert_equal "SELECT \"blocks\".* FROM \"blocks\" WHERE \"blocks\".\"name\" = $? ORDER BY \"blocks\".\"id\" ASC LIMIT $?", third_span[:data][:activerecord][:sql]
36
- assert_equal "DELETE FROM \"blocks\" WHERE \"blocks\".\"id\" = $?", fourth_span[:data][:activerecord][:sql]
37
-
38
- assert_equal "postgresql", second_span[:data][:activerecord][:adapter]
39
- assert_equal "postgresql", third_span[:data][:activerecord][:adapter]
40
- assert_equal "postgresql", fourth_span[:data][:activerecord][:adapter]
41
-
42
- assert_equal ENV['TRAVIS_PSQL_HOST'], second_span[:data][:activerecord][:host]
43
- assert_equal ENV['TRAVIS_PSQL_HOST'], third_span[:data][:activerecord][:host]
44
- assert_equal ENV['TRAVIS_PSQL_HOST'], fourth_span[:data][:activerecord][:host]
45
-
46
- assert_equal "postgres", second_span[:data][:activerecord][:username]
47
- assert_equal "postgres", third_span[:data][:activerecord][:username]
48
- assert_equal "postgres", fourth_span[:data][:activerecord][:username]
49
- end
50
-
51
- def test_mysql2
52
- skip unless ::Instana::Test.mysql2?
53
-
54
- clear_all!
55
-
56
- Net::HTTP.get(URI.parse('http://localhost:3205/test/db'))
57
-
58
- spans = ::Instana.processor.queued_spans
59
- assert_equal 6, spans.length
60
-
61
- first_span = spans[5]
62
- second_span = spans[0]
63
- third_span = spans[1]
64
- fourth_span = spans[2]
65
-
66
- assert_equal :rack, first_span[:n]
67
- assert_equal :activerecord, second_span[:n]
68
- assert_equal :activerecord, third_span[:n]
69
- assert_equal :activerecord, fourth_span[:n]
70
-
71
- assert_equal "INSERT INTO `blocks` (`name`, `color`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?)", second_span[:data][:activerecord][:sql]
72
- assert_equal "SELECT `blocks`.* FROM `blocks` WHERE `blocks`.`name` = ? ORDER BY `blocks`.`id` ASC LIMIT ?", third_span[:data][:activerecord][:sql]
73
- assert_equal "DELETE FROM `blocks` WHERE `blocks`.`id` = ?", fourth_span[:data][:activerecord][:sql]
74
-
75
- assert_equal "mysql2", second_span[:data][:activerecord][:adapter]
76
- assert_equal "mysql2", third_span[:data][:activerecord][:adapter]
77
- assert_equal "mysql2", fourth_span[:data][:activerecord][:adapter]
78
-
79
- assert_equal ENV['TRAVIS_MYSQL_HOST'], second_span[:data][:activerecord][:host]
80
- assert_equal ENV['TRAVIS_MYSQL_HOST'], third_span[:data][:activerecord][:host]
81
- assert_equal ENV['TRAVIS_MYSQL_HOST'], fourth_span[:data][:activerecord][:host]
82
-
83
- assert_equal ENV['TRAVIS_MYSQL_USER'], second_span[:data][:activerecord][:username]
84
- assert_equal ENV['TRAVIS_MYSQL_USER'], third_span[:data][:activerecord][:username]
85
- assert_equal ENV['TRAVIS_MYSQL_USER'], fourth_span[:data][:activerecord][:username]
86
- end
87
- end