marklogic-community / roxy

Deployment tool for MarkLogic applications. Also provides optional unit test and XQuery MVC structure
Other
87 stars 66 forks source link

Not clear how to run self tests #553

Open nespera opened 8 years ago

nespera commented 8 years ago

The documentation just says you need to runml self-test, but it's not clear how much of roxy needs setting up for this to work. Do I need to run ml init and edit build.properties? Anything else?

Additionally, there's an interactive test that asks for username/password and apparently expects these to be bob/smith in order to pass.

grtjn commented 8 years ago

You can clone Roxy, and run ml self-test without doing init first. But it also works when you did init. Self-test relies on the properties inside deploy/test/data/ml7-properties/ (and sibling folders for other versions). It should run completely headless though, and not ask for any user/password..

nespera commented 8 years ago

On master with 8.0.3 running locally I get 4 test failures on a fresh clone, while on dev I also get the test asking me for admin user/password. So I assumed that something needed to be configured.

Finished tests in 22.407606s, 0.7140 tests/s, 1.8744 assertions/s.

  1) Error:
test_0002_should_bootstrap_a_changed_config_file(ServerConfig::bootstrap):
Net::HTTPServerException: 401 "Unauthorized"
    /home/chris/Projects/marklogic-roxy/deploy/lib/MLClient.rb:111:in `go'
    /home/chris/Projects/marklogic-roxy/deploy/lib/server_config.rb:1892:in `get_sid'
    /home/chris/Projects/marklogic-roxy/deploy/lib/server_config.rb:1985:in `execute_query_7'
    /home/chris/Projects/marklogic-roxy/deploy/lib/server_config.rb:509:in `execute_query'
    /home/chris/Projects/marklogic-roxy/deploy/test/test_server_config.rb:74:in `block (3 levels) in <top (required)>'

  2) Error:
test_0002_should_bootstrap_a_changed_config_file(ServerConfig::bootstrap):
Net::HTTPServerException: 401 "Unauthorized"
    /home/chris/Projects/marklogic-roxy/deploy/lib/MLClient.rb:111:in `go'
    /home/chris/Projects/marklogic-roxy/deploy/lib/server_config.rb:1892:in `get_sid'
    /home/chris/Projects/marklogic-roxy/deploy/lib/server_config.rb:1985:in `execute_query_7'
    /home/chris/Projects/marklogic-roxy/deploy/lib/server_config.rb:509:in `execute_query'
    /home/chris/Projects/marklogic-roxy/deploy/lib/server_config.rb:848:in `wipe'
    /home/chris/Projects/marklogic-roxy/deploy/test/test_server_config.rb:104:in `block (3 levels) in <top (required)>'

  3) Error:
test_0001_should_bootstrap_successfully_twice_consecutively(ServerConfig::bootstrap):
Net::HTTPServerException: 401 "Unauthorized"
    /home/chris/Projects/marklogic-roxy/deploy/lib/MLClient.rb:111:in `go'
    /home/chris/Projects/marklogic-roxy/deploy/lib/server_config.rb:1892:in `get_sid'
    /home/chris/Projects/marklogic-roxy/deploy/lib/server_config.rb:1985:in `execute_query_7'
    /home/chris/Projects/marklogic-roxy/deploy/lib/server_config.rb:509:in `execute_query'
    /home/chris/Projects/marklogic-roxy/deploy/test/test_server_config.rb:74:in `block (3 levels) in <top (required)>'

  4) Error:
test_0001_should_bootstrap_successfully_twice_consecutively(ServerConfig::bootstrap):
Net::HTTPServerException: 401 "Unauthorized"
    /home/chris/Projects/marklogic-roxy/deploy/lib/MLClient.rb:111:in `go'
    /home/chris/Projects/marklogic-roxy/deploy/lib/server_config.rb:1892:in `get_sid'
    /home/chris/Projects/marklogic-roxy/deploy/lib/server_config.rb:1985:in `execute_query_7'
    /home/chris/Projects/marklogic-roxy/deploy/lib/server_config.rb:509:in `execute_query'
    /home/chris/Projects/marklogic-roxy/deploy/lib/server_config.rb:848:in `wipe'
    /home/chris/Projects/marklogic-roxy/deploy/test/test_server_config.rb:104:in `block (3 levels) in <top (required)>'

  5) Failure:
test_0001_should_prompt_the_user_for_credentials(ServerConfig::test_credentials) [/home/chris/Projects/marklogic-roxy/deploy/test/test_server_config.rb:180]:
Expected: "bob"
  Actual: "chris"

16 tests, 42 assertions, 1 failures, 4 errors, 0 skips
grtjn commented 7 years ago

Self-test by default runs against localhost and expects being able to access using admin/admin. You can change local-server by adding a local.properties within deploy/test/data/ml7-properties/ or within the folder matching your server version.

Unfortunately the current test code checks user/pass values of the properties, expecting them to match admin/admin. I have addressed that in PR #805..

I agree though, we could spend a few more words on this too in https://github.com/marklogic/roxy/blob/master/CONTRIBUTING.md..