Skip to content

Instantly share code, notes, and snippets.

@rnewson
Created August 12, 2015 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rnewson/6decb160ab9cba056157 to your computer and use it in GitHub Desktop.
Save rnewson/6decb160ab9cba056157 to your computer and use it in GitHub Desktop.
diff --git a/src/setup.erl b/src/setup.erl
index aa2da56..3482b47 100644
--- a/src/setup.erl
+++ b/src/setup.erl
@@ -76,8 +76,8 @@ get_remote_request_options(Options) ->
_ ->
[
{basic_auth, {
- binary_to_list(couch_util:get_value(remote_current_user, Options)),
- binary_to_list(couch_util:get_value(remote_current_password, Options))
+ couch_util:get_value(remote_current_user, Options),
+ couch_util:get_value(remote_current_password, Options)
}}
]
end.
@@ -147,8 +147,10 @@ enable_cluster_int(Options, no) ->
case Port of
undefined ->
ok;
- Port ->
- config:set("httpd", "port", integer_to_list(Port))
+ Port when is_binary(Port) ->
+ config:set("httpd", "port", binary_to_list(Port));
+ Port when is_integer(Port) ->
+ config:set_integer("httpd", "port", Port)
end,
couch_log:notice("Enable Cluster: ~p~n", [Options]).
%cluster_state:set(enabled).
diff --git a/test/t-admin-party.sh b/test/t-admin-party.sh
index 3c94917..4411409 100755
--- a/test/t-admin-party.sh
+++ b/test/t-admin-party.sh
@@ -11,50 +11,52 @@
# License for the specific language governing permissions and limitations under
# the License.
+CURL="curl --fail"
+
HEADERS="-HContent-Type:application/json"
# show cluster state:
-curl 127.0.0.1:15986/_nodes/_all_docs
+$CURL 127.0.0.1:15986/_nodes/_all_docs
# Enable Cluster on node A
-curl 127.0.0.1:15984/_cluster_setup -d '{"action":"enable_cluster","username":"a","password":"b","bind_address":"0.0.0.0"}' $HEADERS
+$CURL 127.0.0.1:15984/_cluster_setup -d '{"action":"enable_cluster","username":"a","password":"b","bind_address":"0.0.0.0"}' $HEADERS
# Add node B on node A
-curl a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"add_node","username":"a","password":"b","host":"127.0.0.1","port":25984}' $HEADERS
+$CURL a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"add_node","username":"a","password":"b","host":"127.0.0.1","port":25984}' $HEADERS
# Enable Cluster on node B
-curl a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"enable_cluster","remote_node":"127.0.0.1","port":"25984","username":"a","password":"b","bind_address":"0.0.0.0"}' $HEADERS
+$CURL a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"enable_cluster","remote_node":"127.0.0.1","port":"25984","username":"a","password":"b","bind_address":"0.0.0.0"}' $HEADERS
# Show cluster state:
-curl a:b@127.0.0.1:15986/_nodes/_all_docs
+$CURL a:b@127.0.0.1:15986/_nodes/_all_docs
# Show db doesn’t exist on node A
-curl a:b@127.0.0.1:15984/foo
+$CURL a:b@127.0.0.1:15984/foo
# Show db doesn’t exist on node B
-curl a:b@127.0.0.1:25984/foo
+$CURL a:b@127.0.0.1:25984/foo
# Create database (on node A)
-curl -X PUT a:b@127.0.0.1:15984/foo
+$CURL -X PUT a:b@127.0.0.1:15984/foo
# Show db does exist on node A
-curl a:b@127.0.0.1:15984/foo
+$CURL a:b@127.0.0.1:15984/foo
# Show db does exist on node B
-curl a:b@127.0.0.1:25984/foo
+$CURL a:b@127.0.0.1:25984/foo
# Finish cluster
-curl a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"finish_cluster"}' $HEADERS
+$CURL a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"finish_cluster"}' $HEADERS
# Show system dbs exist on node A
-curl a:b@127.0.0.1:15984/_users
-curl a:b@127.0.0.1:15984/_replicator
-curl a:b@127.0.0.1:15984/_metadata
-curl a:b@127.0.0.1:15984/_global_changes
+$CURL a:b@127.0.0.1:15984/_users
+$CURL a:b@127.0.0.1:15984/_replicator
+$CURL a:b@127.0.0.1:15984/_metadata
+$CURL a:b@127.0.0.1:15984/_global_changes
# Show system dbs exist on node B
-curl a:b@127.0.0.1:25984/_users
-curl a:b@127.0.0.1:25984/_replicator
-curl a:b@127.0.0.1:25984/_metadata
-curl a:b@127.0.0.1:25984/_global_changes
+$CURL a:b@127.0.0.1:25984/_users
+$CURL a:b@127.0.0.1:25984/_replicator
+$CURL a:b@127.0.0.1:25984/_metadata
+$CURL a:b@127.0.0.1:25984/_global_changes
echo "YAY ALL GOOD"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment