appsignal 3.0.25 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semaphore/semaphore.yml +473 -96
- data/CHANGELOG.md +36 -0
- data/Rakefile +30 -6
- data/build_matrix.yml +99 -39
- data/ext/agent.yml +25 -25
- data/gemfiles/grape.gemfile +1 -1
- data/gemfiles/psych-3.gemfile +5 -0
- data/gemfiles/psych-4.gemfile +5 -0
- data/gemfiles/sequel.gemfile +1 -1
- data/lib/appsignal/config.rb +1 -1
- data/lib/appsignal/extension/jruby.rb +2 -2
- data/lib/appsignal/helpers/instrumentation.rb +3 -3
- data/lib/appsignal/integrations/capistrano/appsignal.cap +1 -1
- data/lib/appsignal/integrations/sidekiq.rb +1 -1
- data/lib/appsignal/probes/helpers.rb +29 -0
- data/lib/appsignal/probes/mri.rb +47 -6
- data/lib/appsignal/probes/sidekiq.rb +10 -23
- data/lib/appsignal/probes.rb +1 -0
- data/lib/appsignal/version.rb +1 -1
- data/script/lint_git +5 -5
- data/spec/lib/appsignal/capistrano3_spec.rb +5 -1
- data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +1 -1
- data/spec/lib/appsignal/probes/mri_spec.rb +79 -8
- data/spec/lib/appsignal/span_spec.rb +4 -2
- metadata +6 -6
- data/lib/appsignal/event_formatter/moped/query_formatter.rb +0 -86
- data/spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb +0 -118
@@ -1,6 +1,8 @@
|
|
1
1
|
module Appsignal
|
2
2
|
module Probes
|
3
3
|
class SidekiqProbe
|
4
|
+
include Helpers
|
5
|
+
|
4
6
|
# @api private
|
5
7
|
attr_reader :config
|
6
8
|
|
@@ -42,11 +44,15 @@ module Appsignal
|
|
42
44
|
|
43
45
|
gauge "worker_count", stats.workers_size
|
44
46
|
gauge "process_count", stats.processes_size
|
45
|
-
gauge_delta :jobs_processed,
|
46
|
-
|
47
|
-
|
47
|
+
jobs_processed = gauge_delta :jobs_processed, stats.processed
|
48
|
+
if jobs_processed
|
49
|
+
gauge "job_count", jobs_processed, :status => :processed
|
50
|
+
end
|
51
|
+
jobs_failed = gauge_delta :jobs_failed, stats.failed
|
52
|
+
gauge "job_count", jobs_failed, :status => :failed if jobs_failed
|
48
53
|
gauge "job_count", stats.retry_size, :status => :retry_queue
|
49
|
-
gauge_delta :jobs_dead,
|
54
|
+
jobs_dead = gauge_delta :jobs_dead, stats.dead_size
|
55
|
+
gauge "job_count", jobs_dead, :status => :died if jobs_dead
|
50
56
|
gauge "job_count", stats.scheduled_size, :status => :scheduled
|
51
57
|
gauge "job_count", stats.enqueued, :status => :enqueued
|
52
58
|
end
|
@@ -65,25 +71,6 @@ module Appsignal
|
|
65
71
|
Appsignal.set_gauge "sidekiq_#{key}", value, tags
|
66
72
|
end
|
67
73
|
|
68
|
-
# Track the delta of two values for a gauge metric
|
69
|
-
#
|
70
|
-
# First call will store the data for the metric and the second call will
|
71
|
-
# set a gauge metric with the difference. This is used for absolute
|
72
|
-
# counter values which we want to track as gauges.
|
73
|
-
#
|
74
|
-
# @example
|
75
|
-
# gauge_delta :my_cache_key, "my_gauge", 10
|
76
|
-
# gauge_delta :my_cache_key, "my_gauge", 15
|
77
|
-
# # Creates a gauge with the value `5`
|
78
|
-
# @see #gauge
|
79
|
-
def gauge_delta(cache_key, key, value, tags = {})
|
80
|
-
previous_value = cache[cache_key]
|
81
|
-
cache[cache_key] = value
|
82
|
-
return unless previous_value
|
83
|
-
new_value = value - previous_value
|
84
|
-
gauge key, new_value, tags
|
85
|
-
end
|
86
|
-
|
87
74
|
def hostname
|
88
75
|
return @hostname if defined?(@hostname)
|
89
76
|
if config.key?(:hostname)
|
data/lib/appsignal/probes.rb
CHANGED
data/lib/appsignal/version.rb
CHANGED
data/script/lint_git
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
set -eu
|
4
4
|
|
5
|
-
LINTJE_VERSION="0.
|
5
|
+
LINTJE_VERSION="0.7.1"
|
6
6
|
|
7
|
-
mkdir -p $HOME/bin
|
7
|
+
mkdir -p "$HOME/bin"
|
8
8
|
cache_key=v1-lintje-$LINTJE_VERSION
|
9
9
|
cache restore $cache_key
|
10
10
|
|
@@ -15,8 +15,8 @@ else
|
|
15
15
|
echo "Downloading Lintje $LINTJE_VERSION"
|
16
16
|
curl -L \
|
17
17
|
https://github.com/tombruijn/lintje/releases/download/v$LINTJE_VERSION/x86_64-unknown-linux-gnu.tar.gz | \
|
18
|
-
tar -xz --directory $HOME/bin
|
19
|
-
cache store $cache_key $HOME/bin/lintje
|
18
|
+
tar -xz --directory "$HOME/bin"
|
19
|
+
cache store $cache_key "$HOME/bin/lintje"
|
20
20
|
fi
|
21
21
|
|
22
|
-
$HOME/bin/lintje $SEMAPHORE_GIT_COMMIT_RANGE
|
22
|
+
"$HOME/bin/lintje" "$SEMAPHORE_GIT_COMMIT_RANGE"
|
@@ -42,7 +42,11 @@ if DependencyHelper.capistrano3_present?
|
|
42
42
|
describe "appsignal:deploy task" do
|
43
43
|
before do
|
44
44
|
ENV["USER"] = "batman"
|
45
|
-
|
45
|
+
end
|
46
|
+
around do |example|
|
47
|
+
Dir.chdir project_fixture_path do
|
48
|
+
example.run
|
49
|
+
end
|
46
50
|
end
|
47
51
|
|
48
52
|
context "config" do
|
@@ -2,7 +2,7 @@ describe Appsignal::EventFormatter::ElasticSearch::SearchFormatter do
|
|
2
2
|
let(:klass) { Appsignal::EventFormatter::ElasticSearch::SearchFormatter }
|
3
3
|
let(:formatter) { klass.new }
|
4
4
|
|
5
|
-
it "should register
|
5
|
+
it "should register search.elasticsearch" do
|
6
6
|
expect(
|
7
7
|
Appsignal::EventFormatter.registered?("search.elasticsearch", klass)
|
8
8
|
).to be_truthy
|
@@ -1,5 +1,23 @@
|
|
1
|
+
class AppsignalMock
|
2
|
+
attr_reader :distribution_values, :gauges
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
@distribution_values = []
|
6
|
+
@gauges = []
|
7
|
+
end
|
8
|
+
|
9
|
+
def add_distribution_value(*args)
|
10
|
+
@distribution_values << args
|
11
|
+
end
|
12
|
+
|
13
|
+
def set_gauge(*args) # rubocop:disable Naming/AccessorMethodName
|
14
|
+
@gauges << args
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
1
18
|
describe Appsignal::Probes::MriProbe do
|
2
|
-
let(:
|
19
|
+
let(:appsignal_mock) { AppsignalMock.new }
|
20
|
+
let(:probe) { described_class.new(appsignal_mock) }
|
3
21
|
|
4
22
|
describe ".dependencies_present?" do
|
5
23
|
if DependencyHelper.running_jruby? || DependencyHelper.running_ruby_2_0?
|
@@ -16,18 +34,71 @@ describe Appsignal::Probes::MriProbe do
|
|
16
34
|
unless DependencyHelper.running_jruby? || DependencyHelper.running_ruby_2_0?
|
17
35
|
describe "#call" do
|
18
36
|
it "should track vm metrics" do
|
19
|
-
|
20
|
-
expect_distribution_value(:
|
37
|
+
probe.call
|
38
|
+
expect_distribution_value("ruby_vm", :class_serial)
|
39
|
+
expect_distribution_value("ruby_vm", :global_constant_state)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "tracks thread counts" do
|
43
|
+
probe.call
|
44
|
+
expect_gauge_value("thread_count")
|
45
|
+
end
|
21
46
|
|
47
|
+
it "tracks GC total time" do
|
22
48
|
probe.call
|
49
|
+
expect_gauge_value("gc_total_time")
|
50
|
+
end
|
51
|
+
|
52
|
+
it "tracks GC run count" do
|
53
|
+
expect(GC).to receive(:count).and_return(10, 15)
|
54
|
+
expect(GC).to receive(:stat).and_return(
|
55
|
+
{ :minor_gc_count => 10, :major_gc_count => 10 },
|
56
|
+
:minor_gc_count => 16, :major_gc_count => 17
|
57
|
+
)
|
58
|
+
probe.call
|
59
|
+
probe.call
|
60
|
+
expect_distribution_value("gc_count", :gc_count, 5)
|
61
|
+
expect_distribution_value("gc_count", :minor_gc_count, 6)
|
62
|
+
expect_distribution_value("gc_count", :major_gc_count, 7)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "tracks object allocation" do
|
66
|
+
expect(GC).to receive(:stat).and_return(
|
67
|
+
{ :total_allocated_objects => 10 },
|
68
|
+
:total_allocated_objects => 15
|
69
|
+
)
|
70
|
+
# Only tracks delta value so the needs to be called twice
|
71
|
+
probe.call
|
72
|
+
probe.call
|
73
|
+
expect_gauge_value("allocated_objects", 5)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "tracks heap slots" do
|
77
|
+
probe.call
|
78
|
+
expect_distribution_value("heap_slots", :heap_live)
|
79
|
+
expect_distribution_value("heap_slots", :heap_free)
|
23
80
|
end
|
24
81
|
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def expect_distribution_value(expected_key, metric, expected_value = nil)
|
85
|
+
expect(appsignal_mock.distribution_values).to satisfy do |distribution_values|
|
86
|
+
distribution_values.any? do |distribution_value|
|
87
|
+
key, value, metadata = distribution_value
|
88
|
+
next unless key == expected_key
|
89
|
+
next unless expected_value ? expected_value == value : !value.nil?
|
90
|
+
next unless metadata == { :metric => metric }
|
25
91
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
92
|
+
true
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def expect_gauge_value(expected_key, expected_value = nil)
|
98
|
+
expect(appsignal_mock.gauges).to satisfy do |gauges|
|
99
|
+
gauges.any? do |(key, value)|
|
100
|
+
expected_key == key && expected_value ? expected_value == value : !value.nil?
|
101
|
+
end
|
31
102
|
end
|
32
103
|
end
|
33
104
|
end
|
@@ -15,7 +15,8 @@ describe Appsignal::Span do
|
|
15
15
|
expect(root.to_h["span_id"].length).to eq 8
|
16
16
|
expect(root.to_h["parent_span_id"]).to be_empty
|
17
17
|
expect(root.to_h["name"]).to be_empty
|
18
|
-
expect(root.to_h["
|
18
|
+
expect(root.to_h["start_time_seconds"]).to be > 1_600_000_000
|
19
|
+
expect(root.to_h["start_time_nanoseconds"]).to be_kind_of(Numeric)
|
19
20
|
expect(root.to_h["closed"]).to be false
|
20
21
|
end
|
21
22
|
end
|
@@ -29,7 +30,8 @@ describe Appsignal::Span do
|
|
29
30
|
expect(child.to_h["span_id"].length).to eq 8
|
30
31
|
expect(child.to_h["parent_span_id"]).to eq root.to_h["span_id"]
|
31
32
|
expect(child.to_h["name"]).to be_empty
|
32
|
-
expect(
|
33
|
+
expect(root.to_h["start_time_seconds"]).to be > 1_600_000_000
|
34
|
+
expect(root.to_h["start_time_nanoseconds"]).to be_kind_of(Numeric)
|
33
35
|
expect(child.to_h["closed"]).to be false
|
34
36
|
end
|
35
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appsignal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-07-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -163,6 +163,8 @@ files:
|
|
163
163
|
- gemfiles/grape.gemfile
|
164
164
|
- gemfiles/no_dependencies.gemfile
|
165
165
|
- gemfiles/padrino.gemfile
|
166
|
+
- gemfiles/psych-3.gemfile
|
167
|
+
- gemfiles/psych-4.gemfile
|
166
168
|
- gemfiles/que.gemfile
|
167
169
|
- gemfiles/que_beta.gemfile
|
168
170
|
- gemfiles/rails-3.2.gemfile
|
@@ -199,7 +201,6 @@ files:
|
|
199
201
|
- lib/appsignal/event_formatter/elastic_search/search_formatter.rb
|
200
202
|
- lib/appsignal/event_formatter/faraday/request_formatter.rb
|
201
203
|
- lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb
|
202
|
-
- lib/appsignal/event_formatter/moped/query_formatter.rb
|
203
204
|
- lib/appsignal/event_formatter/sequel/sql_formatter.rb
|
204
205
|
- lib/appsignal/extension.rb
|
205
206
|
- lib/appsignal/extension/jruby.rb
|
@@ -254,6 +255,7 @@ files:
|
|
254
255
|
- lib/appsignal/marker.rb
|
255
256
|
- lib/appsignal/minutely.rb
|
256
257
|
- lib/appsignal/probes.rb
|
258
|
+
- lib/appsignal/probes/helpers.rb
|
257
259
|
- lib/appsignal/probes/mri.rb
|
258
260
|
- lib/appsignal/probes/sidekiq.rb
|
259
261
|
- lib/appsignal/rack/generic_instrumentation.rb
|
@@ -298,7 +300,6 @@ files:
|
|
298
300
|
- spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb
|
299
301
|
- spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb
|
300
302
|
- spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb
|
301
|
-
- spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
|
302
303
|
- spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb
|
303
304
|
- spec/lib/appsignal/event_formatter_spec.rb
|
304
305
|
- spec/lib/appsignal/extension/jruby_spec.rb
|
@@ -426,7 +427,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
426
427
|
- !ruby/object:Gem::Version
|
427
428
|
version: '0'
|
428
429
|
requirements: []
|
429
|
-
rubygems_version: 3.3.
|
430
|
+
rubygems_version: 3.3.12
|
430
431
|
signing_key:
|
431
432
|
specification_version: 4
|
432
433
|
summary: Logs performance and exception data from your app to appsignal.com
|
@@ -451,7 +452,6 @@ test_files:
|
|
451
452
|
- spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb
|
452
453
|
- spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb
|
453
454
|
- spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb
|
454
|
-
- spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
|
455
455
|
- spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb
|
456
456
|
- spec/lib/appsignal/event_formatter_spec.rb
|
457
457
|
- spec/lib/appsignal/extension/jruby_spec.rb
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Appsignal
|
4
|
-
class EventFormatter
|
5
|
-
# @api private
|
6
|
-
module Moped
|
7
|
-
class QueryFormatter
|
8
|
-
def format(payload)
|
9
|
-
return unless payload[:ops]
|
10
|
-
return if payload[:ops].empty?
|
11
|
-
|
12
|
-
op = payload[:ops].first
|
13
|
-
case op.class.to_s
|
14
|
-
when "Moped::Protocol::Command"
|
15
|
-
[
|
16
|
-
"Command", {
|
17
|
-
:database => op.full_collection_name,
|
18
|
-
:selector => sanitize(op.selector, true, :mongodb)
|
19
|
-
}.inspect
|
20
|
-
]
|
21
|
-
when "Moped::Protocol::Query"
|
22
|
-
[
|
23
|
-
"Query", {
|
24
|
-
:database => op.full_collection_name,
|
25
|
-
:selector => sanitize(op.selector, false, :mongodb),
|
26
|
-
:flags => op.flags,
|
27
|
-
:limit => op.limit,
|
28
|
-
:skip => op.skip,
|
29
|
-
:fields => op.fields
|
30
|
-
}.inspect
|
31
|
-
]
|
32
|
-
when "Moped::Protocol::Delete"
|
33
|
-
[
|
34
|
-
"Delete", {
|
35
|
-
:database => op.full_collection_name,
|
36
|
-
:selector => sanitize(op.selector, false, :mongodb),
|
37
|
-
:flags => op.flags
|
38
|
-
}.inspect
|
39
|
-
]
|
40
|
-
when "Moped::Protocol::Insert"
|
41
|
-
[
|
42
|
-
"Insert", {
|
43
|
-
:database => op.full_collection_name,
|
44
|
-
:documents => sanitize(op.documents, true, :mongodb),
|
45
|
-
:count => op.documents.count,
|
46
|
-
:flags => op.flags
|
47
|
-
}.inspect
|
48
|
-
]
|
49
|
-
when "Moped::Protocol::Update"
|
50
|
-
[
|
51
|
-
"Update",
|
52
|
-
{
|
53
|
-
:database => op.full_collection_name,
|
54
|
-
:selector => sanitize(op.selector, false, :mongodb),
|
55
|
-
:update => sanitize(op.update, true, :mongodb),
|
56
|
-
:flags => op.flags
|
57
|
-
}.inspect
|
58
|
-
]
|
59
|
-
when "Moped::Protocol::KillCursors"
|
60
|
-
[
|
61
|
-
"KillCursors",
|
62
|
-
{ :number_of_cursor_ids => op.number_of_cursor_ids }.inspect
|
63
|
-
]
|
64
|
-
else
|
65
|
-
[
|
66
|
-
op.class.to_s.sub("Moped::Protocol::", ""),
|
67
|
-
{ :database => op.full_collection_name }.inspect
|
68
|
-
]
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
private
|
73
|
-
|
74
|
-
def sanitize(params, only_top_level, key_sanitizer)
|
75
|
-
Appsignal::Utils::QueryParamsSanitizer.sanitize \
|
76
|
-
params, only_top_level, key_sanitizer
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
Appsignal::EventFormatter.register(
|
84
|
-
"query.moped",
|
85
|
-
Appsignal::EventFormatter::Moped::QueryFormatter
|
86
|
-
)
|
@@ -1,118 +0,0 @@
|
|
1
|
-
describe Appsignal::EventFormatter::Moped::QueryFormatter do
|
2
|
-
let(:klass) { Appsignal::EventFormatter::Moped::QueryFormatter }
|
3
|
-
let(:formatter) { klass.new }
|
4
|
-
|
5
|
-
it "should register query.moped" do
|
6
|
-
expect(Appsignal::EventFormatter.registered?("query.moped", klass)).to be_truthy
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "#format" do
|
10
|
-
let(:payload) { { :ops => [op] } }
|
11
|
-
subject { formatter.format(payload) }
|
12
|
-
|
13
|
-
context "without ops in the payload" do
|
14
|
-
let(:payload) { {} }
|
15
|
-
|
16
|
-
it { is_expected.to be_nil }
|
17
|
-
end
|
18
|
-
|
19
|
-
context "when ops is nil in the payload" do
|
20
|
-
let(:payload) { { :ops => nil } }
|
21
|
-
|
22
|
-
it { is_expected.to be_nil }
|
23
|
-
end
|
24
|
-
|
25
|
-
context "Moped::Protocol::Command" do
|
26
|
-
let(:op) do
|
27
|
-
double(
|
28
|
-
:full_collection_name => "database.collection",
|
29
|
-
:selector => { "query" => { "_id" => "abc" } },
|
30
|
-
:class => double(:to_s => "Moped::Protocol::Command")
|
31
|
-
)
|
32
|
-
end
|
33
|
-
|
34
|
-
it { is_expected.to eq ["Command", '{:database=>"database.collection", :selector=>{"query"=>"?"}}'] }
|
35
|
-
end
|
36
|
-
|
37
|
-
context "Moped::Protocol::Query" do
|
38
|
-
let(:op) do
|
39
|
-
double(
|
40
|
-
:full_collection_name => "database.collection",
|
41
|
-
:selector => { "_id" => "abc" },
|
42
|
-
:flags => [],
|
43
|
-
:limit => 0,
|
44
|
-
:skip => 0,
|
45
|
-
:fields => nil,
|
46
|
-
:class => double(:to_s => "Moped::Protocol::Query")
|
47
|
-
)
|
48
|
-
end
|
49
|
-
|
50
|
-
it { is_expected.to eq ["Query", '{:database=>"database.collection", :selector=>{"_id"=>"?"}, :flags=>[], :limit=>0, :skip=>0, :fields=>nil}'] }
|
51
|
-
end
|
52
|
-
|
53
|
-
context "Moped::Protocol::Delete" do
|
54
|
-
let(:op) do
|
55
|
-
double(
|
56
|
-
:full_collection_name => "database.collection",
|
57
|
-
:selector => { "_id" => "abc" },
|
58
|
-
:flags => [],
|
59
|
-
:class => double(:to_s => "Moped::Protocol::Delete")
|
60
|
-
)
|
61
|
-
end
|
62
|
-
|
63
|
-
it { is_expected.to eq ["Delete", '{:database=>"database.collection", :selector=>{"_id"=>"?"}, :flags=>[]}'] }
|
64
|
-
end
|
65
|
-
|
66
|
-
context "Moped::Protocol::Insert" do
|
67
|
-
let(:op) do
|
68
|
-
double(
|
69
|
-
:full_collection_name => "database.collection",
|
70
|
-
:flags => [],
|
71
|
-
:documents => [
|
72
|
-
{ "_id" => "abc", "events" => { "foo" => [{ "bar" => "baz" }] } },
|
73
|
-
{ "_id" => "def", "events" => { "foo" => [{ "baz" => "bar" }] } }
|
74
|
-
],
|
75
|
-
:class => double(:to_s => "Moped::Protocol::Insert")
|
76
|
-
)
|
77
|
-
end
|
78
|
-
|
79
|
-
it { is_expected.to eq ["Insert", '{:database=>"database.collection", :documents=>[{"_id"=>"?", "events"=>"?"}], :count=>2, :flags=>[]}'] }
|
80
|
-
end
|
81
|
-
|
82
|
-
context "Moped::Protocol::Update" do
|
83
|
-
let(:op) do
|
84
|
-
double(
|
85
|
-
:full_collection_name => "database.collection",
|
86
|
-
:selector => { "_id" => "abc" },
|
87
|
-
:update => { "user.name" => "James Bond" },
|
88
|
-
:flags => [],
|
89
|
-
:class => double(:to_s => "Moped::Protocol::Update")
|
90
|
-
)
|
91
|
-
end
|
92
|
-
|
93
|
-
it { is_expected.to eq ["Update", '{:database=>"database.collection", :selector=>{"_id"=>"?"}, :update=>{"user.?"=>"?"}, :flags=>[]}'] }
|
94
|
-
end
|
95
|
-
|
96
|
-
context "Moped::Protocol::KillCursors" do
|
97
|
-
let(:op) do
|
98
|
-
double(
|
99
|
-
:number_of_cursor_ids => 2,
|
100
|
-
:class => double(:to_s => "Moped::Protocol::KillCursors")
|
101
|
-
)
|
102
|
-
end
|
103
|
-
|
104
|
-
it { is_expected.to eq ["KillCursors", "{:number_of_cursor_ids=>2}"] }
|
105
|
-
end
|
106
|
-
|
107
|
-
context "Moped::Protocol::Other" do
|
108
|
-
let(:op) do
|
109
|
-
double(
|
110
|
-
:full_collection_name => "database.collection",
|
111
|
-
:class => double(:to_s => "Moped::Protocol::Other")
|
112
|
-
)
|
113
|
-
end
|
114
|
-
|
115
|
-
it { is_expected.to eq ["Other", '{:database=>"database.collection"}'] }
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|