Skip to content

Instantly share code, notes, and snippets.

@jdickey
Last active March 17, 2017 10:42
Show Gist options
  • Save jdickey/83f202e04f5f23e828132651e540f04c to your computer and use it in GitHub Desktop.
Save jdickey/83f202e04f5f23e828132651e540f04c to your computer and use it in GitHub Desktop.
Attempting to discover reason for test breakage in some/most random-order sequences.

This is essentially a duplicate of/companion to this comment on jdickey/rack-service_api_versioning#14.


We have a temporary branch with some new tests for verifying that an invalid SBU causes an HTTP 400 status code to be generated. Commenting out the tests for that, with the code in place, continues to yield a green bar. Enabling the tests causes failures — in apparently unrelated tests; the invalid-SBU-generates-400 tests always pass.

As a reminder, the only known way to run MiniTest tests in a reproducible order requires a somewhat cumbersome syntax to set the randomisation seed; e.g

ruby -e 'require "./test/rack/service_api_versioning/accept_content_type_selector_test.rb"' -- -v --seed=16442

Using a seed value of 16442 will yield a green bar when used for Commit 8835a06 against either Ruby 2.3.3p222 or 2.4.0p0. Most other seeds, such as 42379, will cause errors (not test failures).

Following is the output from running tests using these two seeds, as well as two other seeds, with the -v option added to report test names as they are executed. Perhaps the more sharp-eyed among you will be able to spot possible avenues to investigate the question of "what really broke the tests?"

File name Seed value Success?
output01.log 16442 Yes
output02.log 0 Yes
output03.log 42379 No
output04.log 1 No

Note that a seed of 0 (zero) appears to run the tests in the order they appear in the test source file, without randomisation. This can be Useful.

$ ruby -e 'require "./test/rack/service_api_versioning/accept_content_type_selector_test.rb"' -- -v --seed=16442
# Running tests with run options -v --seed=16442:
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::specify varying "q" values that have::multiple content types matching "Accept" header entries::having different "q" values#test_0001_matches the entry with the highest "q" value 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::is missing::returns a Rack response with#test_0001_the status (first element) as 400 ("Bad Request") 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::is missing::returns a Rack response with#test_0002_the body contains the correct message 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0001_matches the correct Service Base URL 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0002_has the correct Content Type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::multiple content types that::includes a match for the available API Version#test_0001_matches the content type in both header and list 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0001_matches the correct content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies no "Accept" header::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies no "Accept" header::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies no "Accept" header::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies no "Accept" header::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains a Base URL that is invalid because::the finalising slash (/) is#test_0001_omitted 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains a Base URL that is invalid because::the fully-formed URL was not#test_0001_specified 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::do not specify any "q" values that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::do not specify any "q" values that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains no API Version data::returns a Rack response with#test_0001_the status (first element) as 404 ("Not Found") 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains no API Version data::returns a Rack response with#test_0002_the body contains the correct message 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::do not specify any "q" values that::includes a match for the available API Version#test_0001_has the correct :base_url entry 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::specify varying "q" values that have::a single content type matching available API Versions#test_0001_matches the entry which occurs in the content-type list 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::multiple content types that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::multiple content types that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::specify varying "q" values that have::multiple content types matching "Accept" header entries::where multiple matches have the same "q" value#test_0001_matches the entry occurring first in the content-type list 0.00 = .
Finished tests in 0.017508s, 1485.0467 tests/s, 1485.0467 assertions/s.
26 tests, 26 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for MiniTest to /Users/jeffdickey/src/ruby/rack-service_api_versioning/coverage. 206 / 206 LOC (100.0%) covered.
$ ruby -e 'require "./test/rack/service_api_versioning/accept_content_type_selector_test.rb"' -- -v --seed=0
# Running tests with run options -v --seed=0:
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0001_matches the correct Service Base URL 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0002_has the correct Content Type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::do not specify any "q" values that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::do not specify any "q" values that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::multiple content types that::includes a match for the available API Version#test_0001_matches the content type in both header and list 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies no "Accept" header::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies no "Accept" header::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0001_matches the correct content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::specify varying "q" values that have::a single content type matching available API Versions#test_0001_matches the entry which occurs in the content-type list 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies no "Accept" header::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies no "Accept" header::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::do not specify any "q" values that::includes a match for the available API Version#test_0001_has the correct :base_url entry 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains no API Version data::returns a Rack response with#test_0001_the status (first element) as 404 ("Not Found") 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains no API Version data::returns a Rack response with#test_0002_the body contains the correct message 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::multiple content types that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::multiple content types that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains a Base URL that is invalid because::the fully-formed URL was not#test_0001_specified 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains a Base URL that is invalid because::the finalising slash (/) is#test_0001_omitted 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::is missing::returns a Rack response with#test_0002_the body contains the correct message 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::is missing::returns a Rack response with#test_0001_the status (first element) as 400 ("Bad Request") 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::specify varying "q" values that have::multiple content types matching "Accept" header entries::where multiple matches have the same "q" value#test_0001_matches the entry occurring first in the content-type list 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::specify varying "q" values that have::multiple content types matching "Accept" header entries::having different "q" values#test_0001_matches the entry with the highest "q" value 0.00 = .
Finished tests in 0.017751s, 1464.6714 tests/s, 1464.6714 assertions/s.
26 tests, 26 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for MiniTest to /Users/jeffdickey/src/ruby/rack-service_api_versioning/coverage. 206 / 206 LOC (100.0%) covered.
$ ruby -e 'require "./test/rack/service_api_versioning/accept_content_type_selector_test.rb"' -- -v --seed=42379
# Running tests with run options -v --seed=42379:
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0001_matches the correct content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies no "Accept" header::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies no "Accept" header::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains a Base URL that is invalid because::the fully-formed URL was not#test_0001_specified 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::multiple content types that::includes a match for the available API Version#test_0001_matches the content type in both header and list 0.00 = E
Error:
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::multiple content types that::includes a match for the available API Version#test_0001_matches the content type in both header and list:
InvalidBaseUrlError: Invalidly formatted base URL: v2.example.com:9876/
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:42:in `rescue in version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:39:in `version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:19:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:15:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:42:in `encoded_data_for'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:33:in `add_component_api_version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:73:in `use_api_version'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:58:in `block (2 levels) in match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:52:in `if_requested_api_version_found'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:57:in `block in match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:46:in `if_component_apis_defined'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:56:in `match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:25:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/test/rack/service_api_versioning/accept_content_type_selector_test.rb:145:in `block (3 levels) in <top (required)>'
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::specify varying "q" values that have::multiple content types matching "Accept" header entries::having different "q" values#test_0001_matches the entry with the highest "q" value 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains a Base URL that is invalid because::the finalising slash (/) is#test_0001_omitted 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::specify varying "q" values that have::a single content type matching available API Versions#test_0001_matches the entry which occurs in the content-type list 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::multiple content types that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::multiple content types that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::do not specify any "q" values that::includes a match for the available API Version#test_0001_has the correct :base_url entry 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::do not specify any "q" values that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::do not specify any "q" values that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::specify varying "q" values that have::multiple content types matching "Accept" header entries::where multiple matches have the same "q" value#test_0001_matches the entry occurring first in the content-type list 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::is missing::returns a Rack response with#test_0001_the status (first element) as 400 ("Bad Request") 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::is missing::returns a Rack response with#test_0002_the body contains the correct message 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0001_matches the correct Service Base URL 0.00 = E
Error:
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0001_matches the correct Service Base URL:
InvalidBaseUrlError: Invalidly formatted base URL: http://v2.example.com:9876/foo
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:42:in `rescue in version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:39:in `version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:19:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:15:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:42:in `encoded_data_for'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:33:in `add_component_api_version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:73:in `use_api_version'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:58:in `block (2 levels) in match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:52:in `if_requested_api_version_found'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:57:in `block in match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:46:in `if_component_apis_defined'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:56:in `match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:25:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/test/rack/service_api_versioning/accept_content_type_selector_test.rb:145:in `block (3 levels) in <top (required)>'
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0002_has the correct Content Type 0.00 = E
Error:
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0002_has the correct Content Type:
InvalidBaseUrlError: Invalidly formatted base URL: http://v2.example.com:9876/foo
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:42:in `rescue in version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:39:in `version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:19:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:15:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:42:in `encoded_data_for'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:33:in `add_component_api_version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:73:in `use_api_version'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:58:in `block (2 levels) in match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:52:in `if_requested_api_version_found'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:57:in `block in match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:46:in `if_component_apis_defined'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:56:in `match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:25:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/test/rack/service_api_versioning/accept_content_type_selector_test.rb:145:in `block (3 levels) in <top (required)>'
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies no "Accept" header::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies no "Accept" header::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains no API Version data::returns a Rack response with#test_0001_the status (first element) as 404 ("Not Found") 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains no API Version data::returns a Rack response with#test_0002_the body contains the correct message 0.00 = .
Finished tests in 0.020922s, 1242.7321 tests/s, 1099.3399 assertions/s.
26 tests, 23 assertions, 0 failures, 3 errors, 0 skips
Coverage report generated for MiniTest to /Users/jeffdickey/src/ruby/rack-service_api_versioning/coverage. 206 / 206 LOC (100.0%) covered.
$ ruby -e 'require "./test/rack/service_api_versioning/accept_content_type_selector_test.rb"' -- -v --seed=1
# Running tests with run options -v --seed=1:
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains a Base URL that is invalid because::the fully-formed URL was not#test_0001_specified 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains a Base URL that is invalid because::the finalising slash (/) is#test_0001_omitted 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0002_has the correct Content Type 0.00 = E
Error:
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0002_has the correct Content Type:
InvalidBaseUrlError: Invalidly formatted base URL: http://v2.example.com:9876/foo
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:42:in `rescue in version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:39:in `version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:19:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:15:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:42:in `encoded_data_for'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:33:in `add_component_api_version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:73:in `use_api_version'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:58:in `block (2 levels) in match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:52:in `if_requested_api_version_found'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:57:in `block in match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:46:in `if_component_apis_defined'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:56:in `match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:25:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/test/rack/service_api_versioning/accept_content_type_selector_test.rb:145:in `block (3 levels) in <top (required)>'
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0001_matches the correct Service Base URL 0.00 = E
Error:
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0001_matches the correct Service Base URL:
InvalidBaseUrlError: Invalidly formatted base URL: http://v2.example.com:9876/foo
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:42:in `rescue in version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:39:in `version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:19:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:15:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:42:in `encoded_data_for'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:33:in `add_component_api_version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:73:in `use_api_version'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:58:in `block (2 levels) in match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:52:in `if_requested_api_version_found'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:57:in `block in match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:46:in `if_component_apis_defined'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:56:in `match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:25:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/test/rack/service_api_versioning/accept_content_type_selector_test.rb:145:in `block (3 levels) in <top (required)>'
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0001_matches the correct content type 0.01 = F
Failure:
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::a single content type that::is an exact match for the available version#test_0001_matches the correct content type [/Users/jeffdickey/src/ruby/rack-service_api_versioning/test/rack/service_api_versioning/accept_content_type_selector_test.rb:283]
Minitest::Assertion: --- expected
+++ actual
@@ -1 +1 @@
-"http://v2.example.com:9876/foo"
+"http://v2.example.com:9876/"
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::multiple content types that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::multiple content types that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies no "Accept" header::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies no "Accept" header::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::specify varying "q" values that have::multiple content types matching "Accept" header entries::where multiple matches have the same "q" value#test_0001_matches the entry occurring first in the content-type list 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains no API Version data::returns a Rack response with#test_0001_the status (first element) as 404 ("Not Found") 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::contains no API Version data::returns a Rack response with#test_0002_the body contains the correct message 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::do not specify any "q" values that::includes a match for the available API Version#test_0001_has the correct :base_url entry 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::specify varying "q" values that have::multiple content types matching "Accept" header entries::having different "q" values#test_0001_matches the entry with the highest "q" value 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::multiple content types that::includes a match for the available API Version#test_0001_matches the content type in both header and list 0.00 = E
Error:
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::multiple content types that::includes a match for the available API Version#test_0001_matches the content type in both header and list:
InvalidBaseUrlError: Invalidly formatted base URL: http://v2.example.com:9876/foo
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:42:in `rescue in version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:39:in `version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:19:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/encoded_api_version_data.rb:15:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:42:in `encoded_data_for'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:33:in `add_component_api_version_data'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:73:in `use_api_version'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:58:in `block (2 levels) in match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:52:in `if_requested_api_version_found'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:57:in `block in match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:46:in `if_component_apis_defined'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:56:in `match_request_from_header'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/lib/rack/service_api_versioning/accept_content_type_selector.rb:25:in `call'
/Users/jeffdickey/src/ruby/rack-service_api_versioning/test/rack/service_api_versioning/accept_content_type_selector_test.rb:145:in `block (3 levels) in <top (required)>'
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::specify varying "q" values that have::a single content type matching available API Versions#test_0001_matches the entry which occurs in the content-type list 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies no "Accept" header::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies no "Accept" header::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::do not specify any "q" values that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::where the Target Service has multlple API Versions::when the request supplies an "Accept header" with::multiple content types that::do not specify any "q" values that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0001_an HTTP 406 status code 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when the Target Service has a single API Version::when the request supplies an "Accept header" with::a single content type that::does not match the available API Version::the request is aborted with#test_0002_the message body reporting the only acceptable content type 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::is missing::returns a Rack response with#test_0001_the status (first element) as 400 ("Bad Request") 0.00 = .
Rack::ServiceApiVersioning::AcceptContentTypeSelector::when called with a COMPONENT_DESCRIPTION value that::is missing::returns a Rack response with#test_0002_the body contains the correct message 0.00 = .
Finished tests in 0.030841s, 843.0395 tests/s, 745.7657 assertions/s.
26 tests, 23 assertions, 1 failures, 3 errors, 0 skips
Coverage report generated for MiniTest to /Users/jeffdickey/src/ruby/rack-service_api_versioning/coverage. 206 / 206 LOC (100.0%) covered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment