wohali closed pull request #1708: #1705 Add UUID attribute to welcome message URL: https://github.com/apache/couchdb/pull/1708
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/src/chttpd/src/chttpd_misc.erl b/src/chttpd/src/chttpd_misc.erl index 39ffa23688..1a6b3cb50f 100644 --- a/src/chttpd/src/chttpd_misc.erl +++ b/src/chttpd/src/chttpd_misc.erl @@ -50,6 +50,7 @@ handle_welcome_req(#httpd{method='GET'}=Req, WelcomeMessage) -> {couchdb, WelcomeMessage}, {version, list_to_binary(couch_server:get_version())}, {git_sha, list_to_binary(couch_server:get_git_sha())}, + {uuid, couch_server:get_uuid()}, {features, config:features()} ] ++ case config:get("vendor") of [] -> diff --git a/src/chttpd/test/chttpd_welcome_test.erl b/src/chttpd/test/chttpd_welcome_test.erl index b737abd7af..e427f4dff2 100644 --- a/src/chttpd/test/chttpd_welcome_test.erl +++ b/src/chttpd/test/chttpd_welcome_test.erl @@ -45,12 +45,30 @@ welcome_test_() -> fun setup/0, fun teardown/1, [ fun should_have_version/1, - fun should_have_features/1 + fun should_have_features/1, + fun should_have_uuid/1 ] } } }. +should_have_uuid(Url) -> + ?_test(begin + {ok, Status, _, Body} = test_request:get(Url, [?CONTENT_JSON, ?AUTH]), + ?assertEqual(200, Status), + {Json} = ?JSON_DECODE(Body), + CouchDB = couch_util:get_value(<<"couchdb">>, Json, undefined), + Uuid = couch_util:get_value(<<"uuid">>, Json, undefined), + Features = couch_util:get_value(<<"features">>, Json, undefined), + Sha = couch_util:get_value(<<"git_sha">>, Json, undefined), + ?assertNotEqual(Sha, undefined), + ?assertEqual(<<"Welcome">>, CouchDB), + RealUuid = couch_server:get_uuid(), + + ?assertEqual(RealUuid, Uuid), + ?assert(is_list(Features)) + end). + should_have_version(Url) -> ?_test(begin ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services