Issue
When running:
chef-server-ctl test
You might see a few errors as part of the test suite like below:
Failures:
1) authenticate_user POST /authenticate_user with correct credentials superuser user returns 200 ("OK")
[31mFailure/Error:[0m
[31m [0mpost(request_url, superuser, [33m:payload[0m => body).should look_like({[0m
[31m [0m[33m:status[0m => [1;34m200[0m,[0m
[31m [0m[33m:body_exact[0m => response_body[0m
[31m [0m})[0m
[31m[0m
[31m Response should have HTTP status code 200 ('OK'), but it was actually 401 ('Unauthorized')[0m
[31m Reponse Body: {"error":["Failed to authenticate: Username and password incorrect"]}[0m
[36m# ./spec/api/authenticate_user_spec.rb:129:in `block (4 levels) in <top (required)>'[0m
2) users /users/<name> endpoint PUT /users/<name> superuser authenticating after updates when password is unchanged can authenticate as the modified user when password has not been changed.
[31mFailure/Error:[0m
[31m [0mpost(auth_url, superuser, [33m:payload[0m => { [31m[1;31m'[0m[31musername[1;31m'[0m[31m[0m => username,[0m
[31m [0m[31m[1;31m'[0m[31mpassword[1;31m'[0m[31m[0m => password }).should look_like({[0m
[31m [0m[33m:status[0m => [1;34m200[0m[0m
[31m [0m})[0m
[31m[0m
[31m Response should have HTTP status code 200 ('OK'), but it was actually 401 ('Unauthorized')[0m
[31m Reponse Body: {"error":["Failed to authenticate: Username and password incorrect"]}[0m
[36m# ./spec/api/user_spec.rb:1041:in `block (7 levels) in <top (required)>'[0m
Finished in 1 minute 43.06 seconds (files took 6.85 seconds to load)
[31m172 examples, 2 failures, 2 pending[0m
Failed examples:
[31mrspec ./spec/api/authenticate_user_spec.rb:128[0m [36m# authenticate_user POST /authenticate_user with correct credentials superuser user returns 200 ("OK")[0m
[31mrspec ./spec/api/user_spec.rb:1039[0m [36m# users /users/<name> endpoint PUT /users/<name> superuser authenticating after updates when password is unchanged can authenticate as the modified user when password has not been changed.[0m
Environment
All versions of Chef Infra Server, all topologies/architectures.
Cause
If you are deploying/commissioning a system this likely a result of configuring and using an external authentication mechanism such as LDAP, for which this test suite was never designed.
Resolution
This is a known bug in chef-server-ctl test, but at the time of writing, there is no priority to fix it and these errors should be ignored. If you wish to momentarily comment out the LDAP configuration in your chef-server.rb and re-apply the test to validate that the builtin authentication works as expected, that may be useful for your own purposes, but otherwise this error can be ignored.