traceview 3.0.2-java → 3.0.3-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +39 -14
  3. data/Gemfile +4 -62
  4. data/Rakefile +23 -8
  5. data/gemfiles/frameworks.gemfile +40 -0
  6. data/gemfiles/libraries.gemfile +78 -0
  7. data/gemfiles/rails23.gemfile +47 -0
  8. data/gemfiles/rails30.gemfile +47 -0
  9. data/gemfiles/rails31.gemfile +47 -0
  10. data/gemfiles/rails32.gemfile +47 -0
  11. data/gemfiles/rails40.gemfile +35 -0
  12. data/gemfiles/rails41.gemfile +35 -0
  13. data/gemfiles/rails42.gemfile +35 -0
  14. data/lib/traceview/api/logging.rb +84 -38
  15. data/lib/traceview/frameworks/rails/inst/action_controller.rb +1 -1
  16. data/lib/traceview/inst/moped.rb +2 -2
  17. data/lib/traceview/util.rb +30 -34
  18. data/lib/traceview/version.rb +1 -1
  19. data/test/frameworks/apps/grape_nested.rb +3 -0
  20. data/test/frameworks/apps/grape_simple.rb +3 -0
  21. data/test/frameworks/apps/sinatra_simple.rb +3 -0
  22. data/test/frameworks/grape_test.rb +8 -4
  23. data/test/frameworks/padrino_test.rb +6 -2
  24. data/test/frameworks/rails2x_test.rb +3 -0
  25. data/test/frameworks/rails3x_test.rb +91 -0
  26. data/test/frameworks/rails4x_test.rb +89 -0
  27. data/test/frameworks/sinatra_test.rb +3 -0
  28. data/test/instrumentation/cassandra_test.rb +11 -4
  29. data/test/instrumentation/dalli_test.rb +3 -0
  30. data/test/instrumentation/em_http_request_test.rb +3 -0
  31. data/test/instrumentation/excon_test.rb +3 -0
  32. data/test/instrumentation/faraday_test.rb +3 -0
  33. data/test/instrumentation/http_test.rb +3 -0
  34. data/test/instrumentation/httpclient_test.rb +3 -0
  35. data/test/instrumentation/memcache_test.rb +9 -0
  36. data/test/instrumentation/memcached_test.rb +3 -0
  37. data/test/instrumentation/mongo_test.rb +14 -3
  38. data/test/instrumentation/moped_test.rb +29 -6
  39. data/test/instrumentation/rack_test.rb +3 -0
  40. data/test/instrumentation/redis_hashes_test.rb +187 -184
  41. data/test/instrumentation/redis_keys_test.rb +223 -220
  42. data/test/instrumentation/redis_lists_test.rb +225 -225
  43. data/test/instrumentation/redis_misc_test.rb +123 -120
  44. data/test/instrumentation/redis_sets_test.rb +216 -213
  45. data/test/instrumentation/redis_sortedsets_test.rb +245 -242
  46. data/test/instrumentation/redis_strings_test.rb +242 -238
  47. data/test/instrumentation/resque_test.rb +3 -0
  48. data/test/instrumentation/rest-client_test.rb +3 -0
  49. data/test/instrumentation/sequel_mysql2_test.rb +4 -1
  50. data/test/instrumentation/sequel_mysql_test.rb +4 -1
  51. data/test/instrumentation/sequel_pg_test.rb +4 -1
  52. data/test/minitest_helper.rb +25 -8
  53. data/test/profiling/method_test.rb +3 -0
  54. data/test/servers/rackapp_8101.rb +1 -1
  55. data/test/servers/rails2x_8140.rb +2 -2
  56. data/test/servers/rails3x_8140.rb +78 -0
  57. data/test/servers/rails4x_8140.rb +78 -0
  58. data/test/support/backcompat_test.rb +3 -0
  59. data/test/support/config_test.rb +3 -0
  60. data/test/support/dnt_test.rb +3 -0
  61. data/test/support/liboboe_settings_test.rb +3 -0
  62. data/test/support/tvalias_test.rb +3 -0
  63. data/test/support/xtrace_test.rb +3 -0
  64. metadata +19 -5
  65. data/Appraisals +0 -10
  66. data/gemfiles/mongo.gemfile +0 -33
  67. data/gemfiles/moped.gemfile +0 -33
@@ -1,160 +1,163 @@
1
+ # Copyright (c) 2015 AppNeta, Inc.
2
+ # All rights reserved.
3
+
1
4
  require 'minitest_helper'
2
- require "redis"
3
5
 
4
- describe "Redis Misc" do
5
- attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
6
+ if defined?(::Redis)
7
+ describe "Redis Misc" do
8
+ attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
6
9
 
7
- def min_server_version(version)
8
- unless Gem::Version.new(@redis_version) >= Gem::Version.new(version.to_s)
9
- skip "supported only on redis-server #{version} or greater"
10
+ def min_server_version(version)
11
+ unless Gem::Version.new(@redis_version) >= Gem::Version.new(version.to_s)
12
+ skip "supported only on redis-server #{version} or greater"
13
+ end
10
14
  end
11
- end
12
15
 
13
- before do
14
- clear_all_traces
16
+ before do
17
+ clear_all_traces
15
18
 
16
- @redis ||= Redis.new
19
+ @redis ||= Redis.new
17
20
 
18
- @redis_version ||= @redis.info["redis_version"]
21
+ @redis_version ||= @redis.info["redis_version"]
19
22
 
20
- # These are standard entry/exit KVs that are passed up with all moped operations
21
- @entry_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'entry' }
22
- @exit_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'exit' }
23
- end
23
+ # These are standard entry/exit KVs that are passed up with all moped operations
24
+ @entry_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'entry' }
25
+ @exit_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'exit' }
26
+ end
27
+
28
+ it "should trace publish" do
29
+ min_server_version(2.0)
24
30
 
25
- it "should trace publish" do
26
- min_server_version(2.0)
31
+ TraceView::API.start_trace('redis_test', '', {}) do
32
+ @redis.publish("channel1", "Broadcasting live from silicon circuits.")
33
+ end
27
34
 
28
- TraceView::API.start_trace('redis_test', '', {}) do
29
- @redis.publish("channel1", "Broadcasting live from silicon circuits.")
35
+ traces = get_all_traces
36
+ traces.count.must_equal 4
37
+ traces[2]['KVOp'].must_equal "publish"
38
+ traces[2]['channel'].must_equal "channel1"
39
+ traces[2].has_key?('KVKey').must_equal false
30
40
  end
31
41
 
32
- traces = get_all_traces
33
- traces.count.must_equal 4
34
- traces[2]['KVOp'].must_equal "publish"
35
- traces[2]['channel'].must_equal "channel1"
36
- traces[2].has_key?('KVKey').must_equal false
37
- end
42
+ it "should trace select" do
43
+ min_server_version(2.0)
38
44
 
39
- it "should trace select" do
40
- min_server_version(2.0)
45
+ TraceView::API.start_trace('redis_test', '', {}) do
46
+ @redis.select(2)
47
+ end
41
48
 
42
- TraceView::API.start_trace('redis_test', '', {}) do
43
- @redis.select(2)
49
+ traces = get_all_traces
50
+ traces.count.must_equal 4
51
+ traces[2]['KVOp'].must_equal "select"
52
+ traces[2]['db'].must_equal 2
44
53
  end
45
54
 
46
- traces = get_all_traces
47
- traces.count.must_equal 4
48
- traces[2]['KVOp'].must_equal "select"
49
- traces[2]['db'].must_equal 2
50
- end
51
-
52
- it "should trace pipelined operations" do
53
- min_server_version(1.2)
55
+ it "should trace pipelined operations" do
56
+ min_server_version(1.2)
54
57
 
55
- TraceView::API.start_trace('redis_test', '', {}) do
56
- @redis.pipelined do
57
- @redis.zadd("staff", 0, "waiter")
58
- @redis.zadd("staff", 1, "busser")
59
- @redis.zadd("staff", 2, "chef")
58
+ TraceView::API.start_trace('redis_test', '', {}) do
59
+ @redis.pipelined do
60
+ @redis.zadd("staff", 0, "waiter")
61
+ @redis.zadd("staff", 1, "busser")
62
+ @redis.zadd("staff", 2, "chef")
60
63
 
61
- @redis.lpush("fringe", "bishop")
62
- @redis.lpush("fringe", "dunham")
63
- @redis.lpush("fringe", "broyles")
64
+ @redis.lpush("fringe", "bishop")
65
+ @redis.lpush("fringe", "dunham")
66
+ @redis.lpush("fringe", "broyles")
67
+ end
64
68
  end
65
- end
66
69
 
67
- traces = get_all_traces
68
- traces.count.must_equal 4
69
- traces[2]['KVOpCount'].must_equal 6
70
- traces[2]['KVOps'].must_equal "zadd, zadd, zadd, lpush, lpush, lpush"
71
- end
70
+ traces = get_all_traces
71
+ traces.count.must_equal 4
72
+ traces[2]['KVOpCount'].must_equal 6
73
+ traces[2]['KVOps'].must_equal "zadd, zadd, zadd, lpush, lpush, lpush"
74
+ end
72
75
 
73
- it "should trace multi with block" do
74
- min_server_version(1.2)
76
+ it "should trace multi with block" do
77
+ min_server_version(1.2)
75
78
 
76
- TraceView::API.start_trace('redis_test', '', {}) do
77
- @redis.multi do
78
- @redis.zadd("presidents", 0, "Lincoln")
79
- @redis.zadd("presidents", 1, "Adams")
80
- @redis.zadd("presidents", 2, "Reagan")
79
+ TraceView::API.start_trace('redis_test', '', {}) do
80
+ @redis.multi do
81
+ @redis.zadd("presidents", 0, "Lincoln")
82
+ @redis.zadd("presidents", 1, "Adams")
83
+ @redis.zadd("presidents", 2, "Reagan")
81
84
 
82
- @redis.lpush("hair", "blue")
83
- @redis.lpush("hair", "gray")
84
- @redis.lpush("hair", "yellow")
85
+ @redis.lpush("hair", "blue")
86
+ @redis.lpush("hair", "gray")
87
+ @redis.lpush("hair", "yellow")
88
+ end
85
89
  end
90
+
91
+ traces = get_all_traces
92
+ traces.count.must_equal 4
93
+ traces[2]['KVOpCount'].must_equal 8
94
+ traces[2]['KVOps'].must_equal "multi, zadd, zadd, zadd, lpush, lpush, lpush, exec"
86
95
  end
87
96
 
88
- traces = get_all_traces
89
- traces.count.must_equal 4
90
- traces[2]['KVOpCount'].must_equal 8
91
- traces[2]['KVOps'].must_equal "multi, zadd, zadd, zadd, lpush, lpush, lpush, exec"
92
- end
97
+ it "should trace eval" do
98
+ min_server_version(2.6)
93
99
 
94
- it "should trace eval" do
95
- min_server_version(2.6)
100
+ TraceView::API.start_trace('redis_test', '', {}) do
101
+ @redis.eval("return 1")
102
+ @redis.eval("return { KEYS, ARGV }", ["k1", "k2"], ["a1", "a2"])
103
+ @redis.eval("return { KEYS, ARGV }", :keys => ["k1", "k2"], :argv => ["a1", "a2"])
104
+ end
96
105
 
97
- TraceView::API.start_trace('redis_test', '', {}) do
98
- @redis.eval("return 1")
99
- @redis.eval("return { KEYS, ARGV }", ["k1", "k2"], ["a1", "a2"])
100
- @redis.eval("return { KEYS, ARGV }", :keys => ["k1", "k2"], :argv => ["a1", "a2"])
106
+ traces = get_all_traces
107
+ traces.count.must_equal 8
108
+ traces[2]['KVOp'].must_equal "eval"
109
+ traces[2]['Script'].must_equal "return 1"
110
+ traces[4]['KVOp'].must_equal "eval"
111
+ traces[4]['Script'].must_equal "return { KEYS, ARGV }"
112
+ traces[6]['KVOp'].must_equal "eval"
113
+ traces[6]['Script'].must_equal "return { KEYS, ARGV }"
101
114
  end
102
115
 
103
- traces = get_all_traces
104
- traces.count.must_equal 8
105
- traces[2]['KVOp'].must_equal "eval"
106
- traces[2]['Script'].must_equal "return 1"
107
- traces[4]['KVOp'].must_equal "eval"
108
- traces[4]['Script'].must_equal "return { KEYS, ARGV }"
109
- traces[6]['KVOp'].must_equal "eval"
110
- traces[6]['Script'].must_equal "return { KEYS, ARGV }"
111
- end
116
+ it "should trace evalsha" do
117
+ min_server_version(2.6)
112
118
 
113
- it "should trace evalsha" do
114
- min_server_version(2.6)
119
+ sha = @redis.script(:load, "return 1")
115
120
 
116
- sha = @redis.script(:load, "return 1")
121
+ TraceView::API.start_trace('redis_test', '', {}) do
122
+ @redis.evalsha(sha)
123
+ end
117
124
 
118
- TraceView::API.start_trace('redis_test', '', {}) do
119
- @redis.evalsha(sha)
125
+ traces = get_all_traces
126
+ traces.count.must_equal 4
127
+ traces[2]['KVOp'].must_equal "evalsha"
128
+ traces[2]['sha'].must_equal sha
120
129
  end
121
130
 
122
- traces = get_all_traces
123
- traces.count.must_equal 4
124
- traces[2]['KVOp'].must_equal "evalsha"
125
- traces[2]['sha'].must_equal sha
126
- end
131
+ it "should trace script" do
132
+ min_server_version(2.6)
127
133
 
128
- it "should trace script" do
129
- min_server_version(2.6)
134
+ TraceView::API.start_trace('redis_test', '', {}) do
135
+ @sha = @redis.script(:load, "return 1")
136
+ @it_exists1 = @redis.script(:exists, @sha)
137
+ @it_exists2 = @redis.script(:exists, [@sha, "other_sha"])
138
+ @redis.script(:flush)
139
+ end
130
140
 
131
- TraceView::API.start_trace('redis_test', '', {}) do
132
- @sha = @redis.script(:load, "return 1")
133
- @it_exists1 = @redis.script(:exists, @sha)
134
- @it_exists2 = @redis.script(:exists, [@sha, "other_sha"])
135
- @redis.script(:flush)
141
+ traces = get_all_traces
142
+ traces.count.must_equal 10
143
+
144
+ # Validate return values
145
+ @it_exists1.must_equal true
146
+ @it_exists2.is_a?(Array).must_equal true
147
+ @it_exists2[0].must_equal true
148
+ @it_exists2[1].must_equal false
149
+
150
+ traces[2]['KVOp'].must_equal "script"
151
+ traces[2]['subcommand'].must_equal "load"
152
+ traces[2]['Script'].must_equal "return 1"
153
+ traces[4]['KVOp'].must_equal "script"
154
+ traces[4]['subcommand'].must_equal "exists"
155
+ traces[4]['KVKey'].must_equal @sha
156
+ traces[6]['KVOp'].must_equal "script"
157
+ traces[6]['subcommand'].must_equal "exists"
158
+ traces[6]['KVKey'].must_equal '["e0e1f9fabfc9d4800c877a703b823ac0578ff8db", "other_sha"]'
159
+ traces[8]['KVOp'].must_equal "script"
160
+ traces[8]['subcommand'].must_equal "flush"
136
161
  end
137
-
138
- traces = get_all_traces
139
- traces.count.must_equal 10
140
-
141
- # Validate return values
142
- @it_exists1.must_equal true
143
- @it_exists2.is_a?(Array).must_equal true
144
- @it_exists2[0].must_equal true
145
- @it_exists2[1].must_equal false
146
-
147
- traces[2]['KVOp'].must_equal "script"
148
- traces[2]['subcommand'].must_equal "load"
149
- traces[2]['Script'].must_equal "return 1"
150
- traces[4]['KVOp'].must_equal "script"
151
- traces[4]['subcommand'].must_equal "exists"
152
- traces[4]['KVKey'].must_equal @sha
153
- traces[6]['KVOp'].must_equal "script"
154
- traces[6]['subcommand'].must_equal "exists"
155
- traces[6]['KVKey'].must_equal '["e0e1f9fabfc9d4800c877a703b823ac0578ff8db", "other_sha"]'
156
- traces[8]['KVOp'].must_equal "script"
157
- traces[8]['subcommand'].must_equal "flush"
158
162
  end
159
163
  end
160
-
@@ -1,293 +1,296 @@
1
+ # Copyright (c) 2015 AppNeta, Inc.
2
+ # All rights reserved.
3
+
1
4
  require 'minitest_helper'
2
- require "redis"
3
5
 
4
- describe "Redis Sets" do
5
- attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
6
+ if defined?(::Redis)
7
+ describe "Redis Sets" do
8
+ attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
6
9
 
7
- def min_server_version(version)
8
- unless Gem::Version.new(@redis_version) >= Gem::Version.new(version.to_s)
9
- skip "supported only on redis-server #{version} or greater"
10
+ def min_server_version(version)
11
+ unless Gem::Version.new(@redis_version) >= Gem::Version.new(version.to_s)
12
+ skip "supported only on redis-server #{version} or greater"
13
+ end
10
14
  end
11
- end
12
-
13
- before do
14
- clear_all_traces
15
15
 
16
- @redis ||= Redis.new
16
+ before do
17
+ clear_all_traces
17
18
 
18
- @redis_version ||= @redis.info["redis_version"]
19
+ @redis ||= Redis.new
19
20
 
20
- # These are standard entry/exit KVs that are passed up with all moped operations
21
- @entry_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'entry' }
22
- @exit_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'exit' }
23
- end
24
-
25
- it "should trace sadd" do
26
- min_server_version(1.0)
21
+ @redis_version ||= @redis.info["redis_version"]
27
22
 
28
- TraceView::API.start_trace('redis_test', '', {}) do
29
- @redis.sadd("shrimp", "fried")
23
+ # These are standard entry/exit KVs that are passed up with all moped operations
24
+ @entry_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'entry' }
25
+ @exit_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'exit' }
30
26
  end
31
27
 
32
- traces = get_all_traces
33
- traces.count.must_equal 4
34
- traces[2]['KVOp'].must_equal "sadd"
35
- traces[2]['KVKey'].must_equal "shrimp"
36
- end
37
-
38
- it "should trace scard" do
39
- min_server_version(1.0)
28
+ it "should trace sadd" do
29
+ min_server_version(1.0)
40
30
 
41
- @redis.sadd("mother sauces", "bechamel")
42
- @redis.sadd("mother sauces", "veloute")
43
- @redis.sadd("mother sauces", "espagnole")
44
- @redis.sadd("mother sauces", "hollandaise")
45
- @redis.sadd("mother sauces", "classic tomate")
31
+ TraceView::API.start_trace('redis_test', '', {}) do
32
+ @redis.sadd("shrimp", "fried")
33
+ end
46
34
 
47
- TraceView::API.start_trace('redis_test', '', {}) do
48
- @redis.scard("mother sauces")
35
+ traces = get_all_traces
36
+ traces.count.must_equal 4
37
+ traces[2]['KVOp'].must_equal "sadd"
38
+ traces[2]['KVKey'].must_equal "shrimp"
49
39
  end
50
40
 
51
- traces = get_all_traces
52
- traces.count.must_equal 4
53
- traces[2]['KVOp'].must_equal "scard"
54
- traces[2]['KVKey'].must_equal "mother sauces"
55
- end
41
+ it "should trace scard" do
42
+ min_server_version(1.0)
56
43
 
57
- it "should trace sdiff" do
58
- min_server_version(1.0)
44
+ @redis.sadd("mother sauces", "bechamel")
45
+ @redis.sadd("mother sauces", "veloute")
46
+ @redis.sadd("mother sauces", "espagnole")
47
+ @redis.sadd("mother sauces", "hollandaise")
48
+ @redis.sadd("mother sauces", "classic tomate")
59
49
 
60
- @redis.sadd("abc", "a")
61
- @redis.sadd("abc", "b")
62
- @redis.sadd("abc", "c")
63
- @redis.sadd("ab", "a")
64
- @redis.sadd("ab", "b")
50
+ TraceView::API.start_trace('redis_test', '', {}) do
51
+ @redis.scard("mother sauces")
52
+ end
65
53
 
66
- TraceView::API.start_trace('redis_test', '', {}) do
67
- @redis.sdiff("abc", "ab")
54
+ traces = get_all_traces
55
+ traces.count.must_equal 4
56
+ traces[2]['KVOp'].must_equal "scard"
57
+ traces[2]['KVKey'].must_equal "mother sauces"
68
58
  end
69
59
 
70
- traces = get_all_traces
71
- traces.count.must_equal 4
72
- traces[2]['KVOp'].must_equal "sdiff"
73
- traces[2].has_key?('KVKey').must_equal false
74
- end
60
+ it "should trace sdiff" do
61
+ min_server_version(1.0)
75
62
 
76
- it "should trace sdiffstore" do
77
- min_server_version(1.0)
63
+ @redis.sadd("abc", "a")
64
+ @redis.sadd("abc", "b")
65
+ @redis.sadd("abc", "c")
66
+ @redis.sadd("ab", "a")
67
+ @redis.sadd("ab", "b")
78
68
 
79
- @redis.sadd("abc", "a")
80
- @redis.sadd("abc", "b")
81
- @redis.sadd("abc", "c")
82
- @redis.sadd("ab", "a")
83
- @redis.sadd("ab", "b")
69
+ TraceView::API.start_trace('redis_test', '', {}) do
70
+ @redis.sdiff("abc", "ab")
71
+ end
84
72
 
85
- TraceView::API.start_trace('redis_test', '', {}) do
86
- @redis.sdiffstore("dest", "abc", "ab")
73
+ traces = get_all_traces
74
+ traces.count.must_equal 4
75
+ traces[2]['KVOp'].must_equal "sdiff"
76
+ traces[2].has_key?('KVKey').must_equal false
87
77
  end
88
78
 
89
- traces = get_all_traces
90
- traces.count.must_equal 4
91
- traces[2]['KVOp'].must_equal "sdiffstore"
92
- traces[2]['destination'].must_equal "dest"
93
- end
79
+ it "should trace sdiffstore" do
80
+ min_server_version(1.0)
94
81
 
95
- it "should trace sinter" do
96
- min_server_version(1.0)
82
+ @redis.sadd("abc", "a")
83
+ @redis.sadd("abc", "b")
84
+ @redis.sadd("abc", "c")
85
+ @redis.sadd("ab", "a")
86
+ @redis.sadd("ab", "b")
97
87
 
98
- @redis.sadd("abc", "a")
99
- @redis.sadd("abc", "b")
100
- @redis.sadd("abc", "c")
101
- @redis.sadd("ab", "a")
102
- @redis.sadd("ab", "b")
88
+ TraceView::API.start_trace('redis_test', '', {}) do
89
+ @redis.sdiffstore("dest", "abc", "ab")
90
+ end
103
91
 
104
- TraceView::API.start_trace('redis_test', '', {}) do
105
- @redis.sinter("abc", "ab")
92
+ traces = get_all_traces
93
+ traces.count.must_equal 4
94
+ traces[2]['KVOp'].must_equal "sdiffstore"
95
+ traces[2]['destination'].must_equal "dest"
106
96
  end
107
97
 
108
- traces = get_all_traces
109
- traces.count.must_equal 4
110
- traces[2]['KVOp'].must_equal "sinter"
111
- traces[2].has_key?('KVKey').must_equal false
112
- end
98
+ it "should trace sinter" do
99
+ min_server_version(1.0)
113
100
 
114
- it "should trace sinterstore" do
115
- min_server_version(1.0)
101
+ @redis.sadd("abc", "a")
102
+ @redis.sadd("abc", "b")
103
+ @redis.sadd("abc", "c")
104
+ @redis.sadd("ab", "a")
105
+ @redis.sadd("ab", "b")
116
106
 
117
- @redis.sadd("abc", "a")
118
- @redis.sadd("abc", "b")
119
- @redis.sadd("abc", "c")
120
- @redis.sadd("ab", "a")
121
- @redis.sadd("ab", "b")
107
+ TraceView::API.start_trace('redis_test', '', {}) do
108
+ @redis.sinter("abc", "ab")
109
+ end
122
110
 
123
- TraceView::API.start_trace('redis_test', '', {}) do
124
- @redis.sinterstore("dest", "abc", "ab")
111
+ traces = get_all_traces
112
+ traces.count.must_equal 4
113
+ traces[2]['KVOp'].must_equal "sinter"
114
+ traces[2].has_key?('KVKey').must_equal false
125
115
  end
126
116
 
127
- traces = get_all_traces
128
- traces.count.must_equal 4
129
- traces[2]['KVOp'].must_equal "sinterstore"
130
- traces[2]['destination'].must_equal "dest"
131
- end
117
+ it "should trace sinterstore" do
118
+ min_server_version(1.0)
132
119
 
133
- it "should trace sismember" do
134
- min_server_version(1.0)
120
+ @redis.sadd("abc", "a")
121
+ @redis.sadd("abc", "b")
122
+ @redis.sadd("abc", "c")
123
+ @redis.sadd("ab", "a")
124
+ @redis.sadd("ab", "b")
135
125
 
136
- @redis.sadd("fibonacci", "0")
137
- @redis.sadd("fibonacci", "1")
138
- @redis.sadd("fibonacci", "1")
139
- @redis.sadd("fibonacci", "2")
140
- @redis.sadd("fibonacci", "3")
141
- @redis.sadd("fibonacci", "5")
142
- @redis.sadd("fibonacci", "8")
126
+ TraceView::API.start_trace('redis_test', '', {}) do
127
+ @redis.sinterstore("dest", "abc", "ab")
128
+ end
143
129
 
144
- TraceView::API.start_trace('redis_test', '', {}) do
145
- @redis.sismember("fibonacci", "5")
130
+ traces = get_all_traces
131
+ traces.count.must_equal 4
132
+ traces[2]['KVOp'].must_equal "sinterstore"
133
+ traces[2]['destination'].must_equal "dest"
146
134
  end
147
135
 
148
- traces = get_all_traces
149
- traces.count.must_equal 4
150
- traces[2]['KVOp'].must_equal "sismember"
151
- traces[2]['KVKey'].must_equal "fibonacci"
152
- end
136
+ it "should trace sismember" do
137
+ min_server_version(1.0)
138
+
139
+ @redis.sadd("fibonacci", "0")
140
+ @redis.sadd("fibonacci", "1")
141
+ @redis.sadd("fibonacci", "1")
142
+ @redis.sadd("fibonacci", "2")
143
+ @redis.sadd("fibonacci", "3")
144
+ @redis.sadd("fibonacci", "5")
145
+ @redis.sadd("fibonacci", "8")
146
+
147
+ TraceView::API.start_trace('redis_test', '', {}) do
148
+ @redis.sismember("fibonacci", "5")
149
+ end
150
+
151
+ traces = get_all_traces
152
+ traces.count.must_equal 4
153
+ traces[2]['KVOp'].must_equal "sismember"
154
+ traces[2]['KVKey'].must_equal "fibonacci"
155
+ end
156
+
157
+ it "should trace smembers" do
158
+ min_server_version(1.0)
153
159
 
154
- it "should trace smembers" do
155
- min_server_version(1.0)
160
+ @redis.sadd("fibonacci", "0")
161
+ @redis.sadd("fibonacci", "1")
162
+ @redis.sadd("fibonacci", "1")
163
+ @redis.sadd("fibonacci", "2")
164
+ @redis.sadd("fibonacci", "3")
156
165
 
157
- @redis.sadd("fibonacci", "0")
158
- @redis.sadd("fibonacci", "1")
159
- @redis.sadd("fibonacci", "1")
160
- @redis.sadd("fibonacci", "2")
161
- @redis.sadd("fibonacci", "3")
166
+ TraceView::API.start_trace('redis_test', '', {}) do
167
+ @redis.smembers("fibonacci")
168
+ end
162
169
 
163
- TraceView::API.start_trace('redis_test', '', {}) do
164
- @redis.smembers("fibonacci")
170
+ traces = get_all_traces
171
+ traces.count.must_equal 4
172
+ traces[2]['KVOp'].must_equal "smembers"
173
+ traces[2]['KVKey'].must_equal "fibonacci"
165
174
  end
166
175
 
167
- traces = get_all_traces
168
- traces.count.must_equal 4
169
- traces[2]['KVOp'].must_equal "smembers"
170
- traces[2]['KVKey'].must_equal "fibonacci"
171
- end
176
+ it "should trace smove" do
177
+ min_server_version(1.0)
172
178
 
173
- it "should trace smove" do
174
- min_server_version(1.0)
179
+ @redis.sadd("numbers", "1")
180
+ @redis.sadd("numbers", "2")
181
+ @redis.sadd("alpha", "two")
175
182
 
176
- @redis.sadd("numbers", "1")
177
- @redis.sadd("numbers", "2")
178
- @redis.sadd("alpha", "two")
183
+ TraceView::API.start_trace('redis_test', '', {}) do
184
+ @redis.smove("alpha", "numbers", "two")
185
+ end
179
186
 
180
- TraceView::API.start_trace('redis_test', '', {}) do
181
- @redis.smove("alpha", "numbers", "two")
187
+ traces = get_all_traces
188
+ traces.count.must_equal 4
189
+ traces[2]['KVOp'].must_equal "smove"
190
+ traces[2]['source'].must_equal "alpha"
191
+ traces[2]['destination'].must_equal "numbers"
182
192
  end
183
193
 
184
- traces = get_all_traces
185
- traces.count.must_equal 4
186
- traces[2]['KVOp'].must_equal "smove"
187
- traces[2]['source'].must_equal "alpha"
188
- traces[2]['destination'].must_equal "numbers"
189
- end
194
+ it "should trace spop" do
195
+ min_server_version(1.0)
190
196
 
191
- it "should trace spop" do
192
- min_server_version(1.0)
197
+ @redis.sadd("fibonacci", "0")
198
+ @redis.sadd("fibonacci", "1")
199
+ @redis.sadd("fibonacci", "1")
193
200
 
194
- @redis.sadd("fibonacci", "0")
195
- @redis.sadd("fibonacci", "1")
196
- @redis.sadd("fibonacci", "1")
201
+ TraceView::API.start_trace('redis_test', '', {}) do
202
+ @redis.spop("fibonacci")
203
+ end
197
204
 
198
- TraceView::API.start_trace('redis_test', '', {}) do
199
- @redis.spop("fibonacci")
205
+ traces = get_all_traces
206
+ traces.count.must_equal 4
207
+ traces[2]['KVOp'].must_equal "spop"
208
+ traces[2]['KVKey'].must_equal "fibonacci"
200
209
  end
201
210
 
202
- traces = get_all_traces
203
- traces.count.must_equal 4
204
- traces[2]['KVOp'].must_equal "spop"
205
- traces[2]['KVKey'].must_equal "fibonacci"
206
- end
211
+ it "should trace srandmember" do
212
+ min_server_version(1.0)
207
213
 
208
- it "should trace srandmember" do
209
- min_server_version(1.0)
214
+ @redis.sadd("fibonacci", "0")
215
+ @redis.sadd("fibonacci", "1")
216
+ @redis.sadd("fibonacci", "1")
210
217
 
211
- @redis.sadd("fibonacci", "0")
212
- @redis.sadd("fibonacci", "1")
213
- @redis.sadd("fibonacci", "1")
218
+ TraceView::API.start_trace('redis_test', '', {}) do
219
+ @redis.srandmember("fibonacci")
220
+ end
214
221
 
215
- TraceView::API.start_trace('redis_test', '', {}) do
216
- @redis.srandmember("fibonacci")
222
+ traces = get_all_traces
223
+ traces.count.must_equal 4
224
+ traces[2]['KVOp'].must_equal "srandmember"
225
+ traces[2]['KVKey'].must_equal "fibonacci"
217
226
  end
218
227
 
219
- traces = get_all_traces
220
- traces.count.must_equal 4
221
- traces[2]['KVOp'].must_equal "srandmember"
222
- traces[2]['KVKey'].must_equal "fibonacci"
223
- end
228
+ it "should trace srem" do
229
+ min_server_version(1.0)
224
230
 
225
- it "should trace srem" do
226
- min_server_version(1.0)
231
+ @redis.sadd("fibonacci", "0")
232
+ @redis.sadd("fibonacci", "1")
233
+ @redis.sadd("fibonacci", "1")
227
234
 
228
- @redis.sadd("fibonacci", "0")
229
- @redis.sadd("fibonacci", "1")
230
- @redis.sadd("fibonacci", "1")
235
+ TraceView::API.start_trace('redis_test', '', {}) do
236
+ @redis.srem("fibonacci", "0")
237
+ end
231
238
 
232
- TraceView::API.start_trace('redis_test', '', {}) do
233
- @redis.srem("fibonacci", "0")
239
+ traces = get_all_traces
240
+ traces.count.must_equal 4
241
+ traces[2]['KVOp'].must_equal "srem"
242
+ traces[2]['KVKey'].must_equal "fibonacci"
234
243
  end
235
244
 
236
- traces = get_all_traces
237
- traces.count.must_equal 4
238
- traces[2]['KVOp'].must_equal "srem"
239
- traces[2]['KVKey'].must_equal "fibonacci"
240
- end
245
+ it "should trace sunion" do
246
+ min_server_version(1.0)
241
247
 
242
- it "should trace sunion" do
243
- min_server_version(1.0)
248
+ @redis.sadd("group1", "moe")
249
+ @redis.sadd("group1", "curly")
250
+ @redis.sadd("group2", "larry")
244
251
 
245
- @redis.sadd("group1", "moe")
246
- @redis.sadd("group1", "curly")
247
- @redis.sadd("group2", "larry")
252
+ TraceView::API.start_trace('redis_test', '', {}) do
253
+ @redis.sunion("group1", "group2")
254
+ end
248
255
 
249
- TraceView::API.start_trace('redis_test', '', {}) do
250
- @redis.sunion("group1", "group2")
256
+ traces = get_all_traces
257
+ traces.count.must_equal 4
258
+ traces[2]['KVOp'].must_equal "sunion"
259
+ traces[2].has_key?('KVKey').must_equal false
251
260
  end
252
261
 
253
- traces = get_all_traces
254
- traces.count.must_equal 4
255
- traces[2]['KVOp'].must_equal "sunion"
256
- traces[2].has_key?('KVKey').must_equal false
257
- end
262
+ it "should trace sunionstore" do
263
+ min_server_version(1.0)
258
264
 
259
- it "should trace sunionstore" do
260
- min_server_version(1.0)
265
+ @redis.sadd("group1", "moe")
266
+ @redis.sadd("group1", "curly")
267
+ @redis.sadd("group2", "larry")
261
268
 
262
- @redis.sadd("group1", "moe")
263
- @redis.sadd("group1", "curly")
264
- @redis.sadd("group2", "larry")
269
+ TraceView::API.start_trace('redis_test', '', {}) do
270
+ @redis.sunionstore("dest", "group1", "group2")
271
+ end
265
272
 
266
- TraceView::API.start_trace('redis_test', '', {}) do
267
- @redis.sunionstore("dest", "group1", "group2")
273
+ traces = get_all_traces
274
+ traces.count.must_equal 4
275
+ traces[2]['KVOp'].must_equal "sunionstore"
276
+ traces[2]['destination'].must_equal "dest"
277
+ traces[2].has_key?('KVKey').must_equal false
268
278
  end
269
279
 
270
- traces = get_all_traces
271
- traces.count.must_equal 4
272
- traces[2]['KVOp'].must_equal "sunionstore"
273
- traces[2]['destination'].must_equal "dest"
274
- traces[2].has_key?('KVKey').must_equal false
275
- end
280
+ it "should trace sscan" do
281
+ min_server_version(2.8)
276
282
 
277
- it "should trace sscan" do
278
- min_server_version(2.8)
283
+ @redis.sadd("group1", "moe")
284
+ @redis.sadd("group1", "curly")
279
285
 
280
- @redis.sadd("group1", "moe")
281
- @redis.sadd("group1", "curly")
286
+ TraceView::API.start_trace('redis_test', '', {}) do
287
+ @redis.sscan("group1", 1)
288
+ end
282
289
 
283
- TraceView::API.start_trace('redis_test', '', {}) do
284
- @redis.sscan("group1", 1)
290
+ traces = get_all_traces
291
+ traces.count.must_equal 4
292
+ traces[2]['KVOp'].must_equal "sscan"
293
+ traces[2]['KVKey'].must_equal "group1"
285
294
  end
286
-
287
- traces = get_all_traces
288
- traces.count.must_equal 4
289
- traces[2]['KVOp'].must_equal "sscan"
290
- traces[2]['KVKey'].must_equal "group1"
291
295
  end
292
296
  end
293
-