taps 0.3.11 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +3 -3
- data/VERSION.yml +1 -1
- data/bin/schema +28 -28
- data/lib/taps/cli.rb +171 -166
- data/lib/taps/config.rb +39 -39
- data/lib/taps/data_stream.rb +291 -291
- data/lib/taps/db_session.rb +13 -13
- data/lib/taps/log.rb +12 -12
- data/lib/taps/monkey.rb +17 -17
- data/lib/taps/multipart.rb +51 -51
- data/lib/taps/operation.rb +525 -525
- data/lib/taps/schema.rb +58 -58
- data/lib/taps/server.rb +154 -154
- data/lib/taps/utils.rb +145 -145
- data/spec/base.rb +11 -11
- data/spec/cli_spec.rb +5 -5
- data/spec/data_stream_spec.rb +16 -16
- data/spec/operation_spec.rb +21 -21
- data/spec/server_spec.rb +26 -26
- data/spec/utils_spec.rb +49 -49
- metadata +5 -5
data/spec/utils_spec.rb
CHANGED
@@ -2,54 +2,54 @@ require File.dirname(__FILE__) + '/base'
|
|
2
2
|
require 'taps/utils'
|
3
3
|
|
4
4
|
describe Taps::Utils do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
5
|
+
it "generates a checksum using crc32" do
|
6
|
+
Taps::Utils.checksum("hello world").should == Zlib.crc32("hello world")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "formats a data hash into one hash that contains an array of headers and an array of array of data" do
|
10
|
+
first_row = { :x => 1, :y => 1 }
|
11
|
+
first_row.stubs(:keys).returns([:x, :y])
|
12
|
+
Taps::Utils.format_data([ first_row, { :x => 2, :y => 2 } ]).should == { :header => [ :x, :y ], :data => [ [1, 1], [2, 2] ] }
|
13
|
+
end
|
14
|
+
|
15
|
+
it "scales chunksize down slowly when the time delta of the block is just over a second" do
|
16
|
+
Time.stubs(:now).returns(10.0).returns(11.5)
|
17
|
+
Taps::Utils.calculate_chunksize(1000) { }.should == 900
|
18
|
+
end
|
19
|
+
|
20
|
+
it "scales chunksize down fast when the time delta of the block is over 3 seconds" do
|
21
|
+
Time.stubs(:now).returns(10.0).returns(15.0)
|
22
|
+
Taps::Utils.calculate_chunksize(3000) { }.should == 1000
|
23
|
+
end
|
24
|
+
|
25
|
+
it "scales up chunksize fast when the time delta of the block is under 0.8 seconds" do
|
26
|
+
Time.stubs(:now).returns(10.0).returns(10.7)
|
27
|
+
Taps::Utils.calculate_chunksize(1000) { }.should == 2000
|
28
|
+
end
|
29
|
+
|
30
|
+
it "scales up chunksize slow when the time delta of the block is between 0.8 and 1.1 seconds" do
|
31
|
+
Time.stubs(:now).returns(10.0).returns(10.8)
|
32
|
+
Taps::Utils.calculate_chunksize(1000) { }.should == 1100
|
33
|
+
|
34
|
+
Time.stubs(:now).returns(10.0).returns(11.1)
|
35
|
+
Taps::Utils.calculate_chunksize(1000) { }.should == 1100
|
36
|
+
end
|
37
|
+
|
38
|
+
it "will reset the chunksize to a small value if we got a broken pipe exception" do
|
39
|
+
Taps::Utils.calculate_chunksize(1000) { |c| raise Errno::EPIPE if c == 1000; c.should == 10 }.should == 10
|
40
|
+
end
|
41
|
+
|
42
|
+
it "will reset the chunksize to a small value if we got a broken pipe exception a second time" do
|
43
|
+
Taps::Utils.calculate_chunksize(1000) { |c| raise Errno::EPIPE if c == 1000 || c == 10; c.should == 1 }.should == 1
|
44
|
+
end
|
45
|
+
|
46
|
+
it "returns a list of columns that are text fields if the database is mysql" do
|
47
|
+
@db = mock("db", :url => "mysql://localhost/mydb")
|
48
|
+
@db.stubs(:schema).with(:mytable).returns([
|
49
|
+
[:id, { :db_type => "int" }],
|
50
|
+
[:mytext, { :db_type => "text" }]
|
51
|
+
])
|
52
|
+
Taps::Utils.incorrect_blobs(@db, :mytable).should == [:mytext]
|
53
|
+
end
|
54
54
|
end
|
55
55
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 12
|
9
|
+
version: 0.3.12
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ricardo Chimal, Jr.
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-09-10 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -75,9 +75,9 @@ dependencies:
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
segments:
|
77
77
|
- 3
|
78
|
-
-
|
78
|
+
- 15
|
79
79
|
- 0
|
80
|
-
version: 3.
|
80
|
+
version: 3.15.0
|
81
81
|
type: :runtime
|
82
82
|
version_requirements: *id004
|
83
83
|
- !ruby/object:Gem::Dependency
|