priam 0.0.4 → 0.0.5
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/VERSION +1 -1
- data/lib/priam/command/insert.rb +1 -1
- data/lib/priam/core/common.rb +0 -1
- data/priam.gemspec +1 -1
- data/spec/bin/priam_spec.rb +27 -16
- data/spec/lib/priam/core/common_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/lib/priam/command/insert.rb
CHANGED
@@ -9,7 +9,7 @@ module Priam::Command
|
|
9
9
|
super_column = params[:super_column]
|
10
10
|
raise_exception_flag = params[:raise_exception_flag]
|
11
11
|
unit_size = params[:unit_size]
|
12
|
-
value_column = params[:value_column]
|
12
|
+
value_column = params[:value_column] || "d"
|
13
13
|
weight_second = params[:weight_second]
|
14
14
|
retry_max_count = params[:retry_max_count]
|
15
15
|
count_log_path = params[:count_log_path]
|
data/lib/priam/core/common.rb
CHANGED
data/priam.gemspec
CHANGED
data/spec/bin/priam_spec.rb
CHANGED
@@ -66,25 +66,36 @@ describe "bin/priam" do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
context "when command = get" do
|
69
|
-
context "
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
context "without value-column option" do
|
70
|
+
context "when key&value exists" do
|
71
|
+
it "should output json" do
|
72
|
+
result = `echo key1 | #{Priam::RUBY_CMD} -I #{Priam::LIB_DIR} #{Priam::BIN_DIR}/priam get --keyspace PriamTest --column-family PriamCF -h #{@hostname} -p 9160 --verbose #{@stderr_dst}`
|
73
|
+
result.chomp!
|
74
|
+
result.should == '{"d":"val1"}'
|
75
|
+
end
|
74
76
|
end
|
75
77
|
end
|
76
|
-
context "
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
context "with value-column option" do
|
79
|
+
context "when key&value exists" do
|
80
|
+
it "should output value" do
|
81
|
+
result = `echo key1 | #{Priam::RUBY_CMD} -I #{Priam::LIB_DIR} #{Priam::BIN_DIR}/priam get --keyspace PriamTest --column-family PriamCF -h #{@hostname} -p 9160 --name d --verbose #{@stderr_dst}`
|
82
|
+
result.chomp!
|
83
|
+
result.should == "val1"
|
84
|
+
end
|
81
85
|
end
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
86
|
+
context "when key&value does not exist" do
|
87
|
+
it "should not output value" do
|
88
|
+
result = `echo nokey | #{Priam::RUBY_CMD} -I #{Priam::LIB_DIR} #{Priam::BIN_DIR}/priam get --keyspace PriamTest --column-family PriamCF -h #{@hostname} -p 9160 --name d --verbose #{@stderr_dst}`
|
89
|
+
result.chomp!
|
90
|
+
result.should == ""
|
91
|
+
end
|
92
|
+
end
|
93
|
+
context "when retry option is enabled" do
|
94
|
+
it "should output value" do
|
95
|
+
result = `echo key1 | #{Priam::RUBY_CMD} -I #{Priam::LIB_DIR} #{Priam::BIN_DIR}/priam get --keyspace PriamTest --column-family PriamCF -h #{@hostname} -p 9160 --name d --retry 5 --weight 1000 --verbose #{@stderr_dst}`
|
96
|
+
result.chomp!
|
97
|
+
result.should == "val1"
|
98
|
+
end
|
88
99
|
end
|
89
100
|
end
|
90
101
|
end
|
@@ -8,7 +8,7 @@ describe Priam::Core::Common do
|
|
8
8
|
result[:host].should == "localhost"
|
9
9
|
result[:port].should == 9160
|
10
10
|
result[:raise_exception_flag].should == false
|
11
|
-
result[:value_column].should ==
|
11
|
+
result[:value_column].should == nil
|
12
12
|
result[:retry_max_count].should == 0
|
13
13
|
result[:check_exist_flag].should == false
|
14
14
|
result[:output_keys_flag].should == false
|
data/spec/spec_helper.rb
CHANGED
@@ -45,7 +45,7 @@ create column family PriamCF
|
|
45
45
|
tmpfile.puts cql
|
46
46
|
tmpfile.close
|
47
47
|
hostname = `hostname`.chomp
|
48
|
-
`/usr/lib/cassandra/bin/cassandra-cli -h #{hostname} -p 9160 -f #{tmpfile.path}`
|
48
|
+
`/usr/lib/cassandra/bin/cassandra-cli -h #{hostname} -p 9160 -f #{tmpfile.path} 2>/dev/null`
|
49
49
|
tmpfile.unlink
|
50
50
|
end
|
51
51
|
|
@@ -55,7 +55,7 @@ create column family PriamCF
|
|
55
55
|
tmpfile.puts cql
|
56
56
|
tmpfile.close
|
57
57
|
hostname = `hostname`.chomp
|
58
|
-
`/usr/lib/cassandra/bin/cassandra-cli -h #{hostname} -p 9160 -f #{tmpfile.path}`
|
58
|
+
`/usr/lib/cassandra/bin/cassandra-cli -h #{hostname} -p 9160 -f #{tmpfile.path} 2>/dev/null`
|
59
59
|
tmpfile.unlink
|
60
60
|
end
|
61
61
|
end
|
metadata
CHANGED