Tests can fail if some env vars are defined
If the DANCER_CONTENT_TYPE is set some tests fails:
DANCER_CONTENT_TYPE=application/json
t/00-compile.t .................. ok
t/00-report-prereqs.t ........... #
# Versions for all modules listed in MYMETA.json (including optional ones):
#
# === Configure Requires ===
#
# Module Want Have
# ----------------------- ------ ----
# ExtUtils::MakeMaker 7.1101 7.24
# File::ShareDir::Install 0.06 0.10
#
# === Build Requires ===
#
# Module Want Have
# ------------------- ---- ----
# ExtUtils::MakeMaker any 7.24
#
# === Test Requires ===
#
# Module Want Have
# ------------------- ---- --------
# Capture::Tiny 0.12 0.36
# ExtUtils::MakeMaker any 7.24
# File::Spec any 3.40
# HTTP::Body any 1.22
# HTTP::Cookies any 6.01
# HTTP::Headers any 6.11
# IO::Handle any 1.34
# IPC::Open3 any 1.13
# Template any 2.26
# Test::Fatal any 0.014
# Test::More 0.92 1.001014
#
# === Test Recommends ===
#
# Module Want Have
# ---------- -------- --------
# CPAN::Meta 2.120900 2.150005
#
# === Runtime Requires ===
#
# Module Want Have
# ------------------------------------------- ---------------- --------
# App::Cmd::Setup any 0.330
# Carp any 1.29
# Config::Any any 0.27
# Digest::SHA any 5.84_01
# Encode any 2.49
# Exporter 5.57 5.68
# Exporter::Tiny any 0.042
# File::Basename any 2.84
# File::Copy any 2.26
# File::Find any 1.23
# File::Path any 2.09
# File::ShareDir any 1.102
# File::Spec any 3.40
# HTTP::Body any 1.22
# HTTP::Date any 6.02
# HTTP::Headers::Fast any 0.20
# HTTP::Tiny any 0.056
# Hash::Merge::Simple any 0.051
# Hash::MultiValue any 0.16
# Import::Into any 1.002005
# JSON::MaybeXS any 1.003005
# MIME::Base64 3.13 3.13
# Module::Runtime any 0.014
# Moo 2.000000 2.001001
# Moo::Role any 2.001001
# MooX::Types::MooseLike any 0.29
# POSIX any 1.32
# Plack 1.0035 1.0039
# Plack::Middleware::FixMissingBodyInRedirect any 0.12
# Plack::Middleware::RemoveRedundantBody any 0.04
# Return::MultiLevel any 0.04
# Role::Tiny 2.000000 2.000001
# Safe::Isa any 1.000005
# Template::Tiny any 1.12
# URI::Escape any 3.31
# YAML >= 0.86, != 1.16 1.15
# parent any 0.225
#
# === Runtime Recommends ===
#
# Module Want Have
# ----------------------- -------- --------
# CGI::Deurl::XS any missing
# Cpanel::JSON::XS any missing
# Crypt::URandom any 0.36
# HTTP::XSCookies 0.000005 missing
# Math::Random::ISAAC::XS any missing
# Pod::Simple::Search any 3.28
# Pod::Simple::SimpleTree any 3.28
# Scope::Upper any missing
# Test::Builder any 1.001014
# Test::More any 1.001014
# URL::Encode::XS any missing
# YAML::XS any missing
#
# === Runtime Suggests ===
#
# Module Want Have
# ----------- ---- -------
# Fcntl any 1.11
# MIME::Types any missing
#
t/00-report-prereqs.t ........... ok
t/app.t ......................... ok
t/app_alone.t ................... ok
t/author-no-tabs.t .............. skipped: these tests are for testing by the author
t/author-pod-syntax.t ........... skipped: these tests are for testing by the author
t/auto_page.t ...................
# Failed test '...with proper content'
# at t/auto_page.t line 36.
# 'layout top
# var =
# before_layout_render =
# ---
# Hey! This is Auto Page w�rking.
#
# ---
# layout bottom
# '
# doesn't match '(?^:---\nHey! This is Auto Page w\x{c3}\x{b6}rking)'
# Failed test 'auto page has correct content type header'
# at t/auto_page.t line 42.
# got: 'application/json'
# expected: 'text/html'
# Failed test 'auto page has correct charset in content type header'
# at t/auto_page.t line 48.
# got: undef
# expected: 'UTF-8'
# Failed test 'auto page has correct content length header'
# at t/auto_page.t line 54.
# got: '97'
# expected: '98'
# Looks like you failed 4 tests of 12.
t/auto_page.t ................... 1/?
# Failed test 'autopage with template tiny'
# at t/auto_page.t line 25.
# Failed test '...with proper content'
# at t/auto_page.t line 36.
# 'layout top
# var =
# before_layout_render =
# ---
# Hey! This is Auto Page w�rking.
#
# ---
# layout bottom
# '
# doesn't match '(?^:---\nHey! This is Auto Page w\x{c3}\x{b6}rking)'
# Failed test 'auto page has correct content type header'
# at t/auto_page.t line 42.
# got: 'application/json'
# expected: 'text/html'
# Failed test 'auto page has correct charset in content type header'
# at t/auto_page.t line 48.
# got: undef
# expected: 'UTF-8'
# Failed test 'auto page has correct content length header'
# at t/auto_page.t line 54.
# got: '97'
# expected: '98'
# Looks like you failed 4 tests of 12.
# Failed test 'autopage with template template_toolkit'
# at t/auto_page.t line 25.
# Looks like you failed 2 tests of 2.
t/auto_page.t ................... Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/2 subtests
t/caller.t ...................... ok
t/charset_server.t .............. 1/?
# Failed test at t/charset_server.t line 40.
# got: 'application/json'
# expected: 'text/html'
# Failed test at t/charset_server.t line 41.
# Failed test at t/charset_server.t line 47.
# got: 'text/plain'
# expected: 'text/html'
# Failed test at t/charset_server.t line 48.
# got: undef
# expected: 'UTF-8'
# Failed test at t/charset_server.t line 49.
# got: 'HTTP::Message content must be bytes at /usr/local/share/perl/5.18.2/HTTP/Message/PSGI.pm line 122.
# '
# expected: 'cyrillic shcha Щ'
# Failed test at t/charset_server.t line 52.
# got: 'text/plain'
# expected: 'text/html'
# Failed test at t/charset_server.t line 53.
# got: undef
# expected: 'UTF-8'
# Failed test at t/charset_server.t line 54.
# got: 'HTTP::Message content must be bytes at /usr/local/share/perl/5.18.2/HTTP/Message/PSGI.pm line 122.
# '
# expected: '⚒ ⚓ ⚔ ⚕ ⚖ ⚗ ⚘ ⚙'
# Looks like you failed 8 tests of 10.
t/charset_server.t .............. Dubious, test returned 8 (wstat 2048, 0x800)
Failed 8/10 subtests
t/config_multiapp.t ............. ok
t/config_reader.t ............... ok
t/config_settings.t ............. 1/?
# Failed test 'default value for 'content_type' is OK'
# at t/config_settings.t line 10.
# got: 'application/json'
# expected: 'text/html'
# Looks like you failed 1 test of 8.
t/config_settings.t ............. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/8 subtests
t/context-in-before.t ........... ok
t/cookie.t ...................... # If you want extra speed, install HTTP::XSCookies
t/cookie.t ...................... ok
t/custom_dsl.t .................. ok
t/dancer-test.t ................. 1/50
# Failed test 'multi utf8 value properly merge'
# at t/dancer-test.t line 122.
Wide character in print at /usr/local/share/perl/5.18.2/Test/Builder.pm line 1826.
# got: 'test/испытание'
# expected: 'test/иÑпÑÑание'
# Looks like you failed 1 test of 50.
t/dancer-test.t ................. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/50 subtests
(less 1 skipped subtest: 48 okay)
t/deserialize.t ................. ok
t/dispatcher.t .................. 1/16
# Failed test '[/] Correct headers'
# at t/dispatcher.t line 184.
# Structures begin differing at:
# $got->{Content-Type} = 'application/json'
# $expected->{Content-Type} = 'text/html; charset=UTF-8'
# Failed test '[/user/Johnny] Correct headers'
# at t/dispatcher.t line 184.
# Structures begin differing at:
# $got->{Content-Type} = 'application/json'
# $expected->{Content-Type} = 'text/html; charset=UTF-8'
# Failed test '[/twoohfour] Correct headers'
# at t/dispatcher.t line 184.
# Structures begin differing at:
# $got->{Content-Type} = 'application/json'
# $expected->{Content-Type} = 'text/html; charset=UTF-8'
# Looks like you failed 3 tests of 16.
t/dispatcher.t .................. Dubious, test returned 3 (wstat 768, 0x300)
Failed 3/16 subtests
t/engine.t ...................... ok
t/error.t ....................... ok
t/factory.t ..................... ok
t/file_utils.t .................. ok
t/forward.t ..................... 1/?
# Failed test '[GET /bounce/] Correct content type'
# at t/forward.t line 108.
# got: 'application/json'
# expected: 'text/html'
# Failed test '[GET /bounce/] Correct content type charset'
# at t/forward.t line 114.
# got: undef
# expected: 'UTF-8'
# Failed test '[POST /bounce/] Correct content type'
# at t/forward.t line 156.
# got: 'application/json'
# expected: 'text/html'
# Failed test '[POST /bounce/] Correct content type charset'
# at t/forward.t line 162.
# got: undef
# expected: 'UTF-8'
# Looks like you failed 4 tests of 24.
t/forward.t ..................... Dubious, test returned 4 (wstat 1024, 0x400)
Failed 4/24 subtests
t/forward_before_hook.t ......... ok
t/forward_test_tcp.t ............ 1/?
# Failed test at t/forward_test_tcp.t line 66.
# got: 'application/json'
# expected: 'text/html; charset=UTF-8'
# Failed test at t/forward_test_tcp.t line 77.
# got: 'application/json'
# expected: 'text/html; charset=UTF-8'
# Looks like you failed 2 tests of 21.
t/forward_test_tcp.t ............ Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/21 subtests
t/hooks.t ....................... ok
t/http_methods.t ................ ok
t/http_status.t ................. ok
t/log_die_before_hook.t ......... ok
t/log_levels.t .................. ok
t/logger.t ...................... ok
t/logger_console.t .............. ok
t/memory_cycles.t ............... skipped: Test::Memory::Cycle not present
t/mime.t ........................ ok
t/multi_apps.t .................. ok
t/multi_apps_forward.t .......... ok
t/multiapp_template_hooks.t ..... ok
t/named_apps.t .................. ok
t/plugin_import.t ............... ok
t/plugin_multiple_apps.t ........ ok
t/plugin_register.t ............. ok
t/plugin_syntax.t ............... ok
t/psgi_app.t .................... ok
t/psgi_app_forward_and_pass.t ... ok
t/redirect.t ....................
# Failed test '[GET /] Correct content-type'
# at t/redirect.t line 31.
# got: 'application/json'
# expected: 'text/html'
# Looks like you failed 1 test of 10.
t/redirect.t .................... 1/?
# Failed test 'basic redirects'
# at t/redirect.t line 74.
# Looks like you failed 1 test of 4.
t/redirect.t .................... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/4 subtests
t/release-distmeta.t ............ skipped: these tests are for release candidate testing
t/request.t ..................... # If you want extra speed, install URL::Encode::XS
# If you want extra speed, install CGI::Deurl::XS
t/request.t ..................... ok
t/request_make_forward_to.t ..... ok
t/request_upload.t .............. # If you want extra speed, install URL::Encode::XS
# If you want extra speed, install CGI::Deurl::XS
t/request_upload.t .............. ok
t/response.t .................... ok
t/serializer.t .................. ok
t/serializer_json.t ............. ok
t/serializer_mutable.t .......... ok
t/session_bad_client_cookie.t ... ok
t/session_config.t .............. ok
t/session_engines.t ............. ok
t/session_forward.t ............. ok
t/session_hooks.t ............... ok
t/session_hooks_no_change_id.t .. ok
t/session_in_template.t ......... ok
t/session_lifecycle.t ........... ok
t/session_object.t .............. ok
t/shared_engines.t .............. ok
t/template.t .................... ok
t/template_default_tokens.t ..... ok
t/template_ext.t ................ ok
t/template_name.t ............... ok
t/template_simple.t ............. ok
t/time.t ........................ ok
t/types.t ....................... ok
t/uri_for.t ..................... ok
t/vars.t ........................ ok
Test Summary Report
-------------------
t/auto_page.t (Wstat: 512 Tests: 2 Failed: 2)
Failed tests: 1-2
Non-zero exit status: 2
t/charset_server.t (Wstat: 2048 Tests: 10 Failed: 8)
Failed tests: 2-3, 5-10
Non-zero exit status: 8
t/config_settings.t (Wstat: 256 Tests: 8 Failed: 1)
Failed test: 2
Non-zero exit status: 1
t/dancer-test.t (Wstat: 256 Tests: 50 Failed: 1)
Failed test: 48
Non-zero exit status: 1
t/dispatcher.t (Wstat: 768 Tests: 16 Failed: 3)
Failed tests: 2, 5, 8
Non-zero exit status: 3
t/forward.t (Wstat: 1024 Tests: 24 Failed: 4)
Failed tests: 13-14, 21-22
Non-zero exit status: 4
t/forward_test_tcp.t (Wstat: 512 Tests: 21 Failed: 2)
Failed tests: 13, 20
Non-zero exit status: 2
t/redirect.t (Wstat: 256 Tests: 4 Failed: 1)
Failed test: 1
Non-zero exit status: 1
Files=72, Tests=896, 23 wallclock secs ( 0.43 usr 0.08 sys + 19.72 cusr 3.05 csys = 23.28 CPU)
Result: FAIL
Similar if support to unicode is enabled:
PERL_UNICODE=SDL
....
t/request_upload.t .............. # If you want extra speed, install URL::Encode::XS
# If you want extra speed, install CGI::Deurl::XS
Bad Content-Length: maybe client disconnect? (1 bytes remaining) at t/request_upload.t line 66.
t/request_upload.t .............. Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run
....
Test Summary Report
-------------------
t/request_upload.t (Wstat: 65280 Tests: 0 Failed: 0)
Non-zero exit status: 255
Parse errors: No plan found in TAP output
Files=72, Tests=877, 23 wallclock secs ( 0.36 usr 0.10 sys + 19.57 cusr 3.03 csys = 23.06 CPU)
Result: FAIL
Maybe specific environment vars that can cause this problems, could be unset before run the tests.
The PERL_UNICODE=SDL maybe, but why would you set the DANCER_CONTENT_TYPE globally when running tests? Is it something you set per user?
We have a containerized api json service and, as we pass all the config throught environment. We set globally Content-type with the env var and when we try to update dancer version, it fails because this, so have to unset the var to make de update.
I'm sorry. I have to go with the slippery slope defense here.
Do we need to now defend all of our testing code from someone tempring with run-time environment variables? If someone has code that sets the locale to something, should we now defend locale config in case it changes output of system errors we then check?
I suggest you fix that environment from setting run-time environment options when you run tests.
Ok with that. My point was about that controlling run-time environment options in tests, maybe just cleaning env hash by default, will allow to pass the tests in a reliable way, so when trying an update, it would not fail because an env var that the user has setted, and that changes test behaviour. But maybe it's not a correct assumption, and we should force install updates without passing the tests and check proper application functionally with our own test suite.