DBIO-PostgreSQL-EV

 view release on metacpan or  search on metacpan

maint/docker/Dockerfile.test  view on Meta::CPAN

# Perl + cpanm + the XS build chain + libldap (a runtime dep of libpq 17;
# EV::Pg's XS module dynamically links it for the LDAP authentication path,
# so it must be present even though our tests never authenticate via LDAP).
# ssl-dev is needed by several of the CPAN deps (Net::SSLeay, IO::Socket::SSL,
# etc.).
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
         perl \
         cpanminus \
         build-essential \
         pkg-config \
         libssl-dev \
         libldap-2.5-0 \
         ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# Tell pkg-config and the EV::Pg build where to find libpq 17.
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

WORKDIR /src

# Copy cpanfile + the rest of the source in one shot so cpanm --installdeps
# can resolve the distribution's runtime + test deps from the same tree.
COPY cpanfile dist.ini ./
COPY lib/ ./lib/
COPY t/ ./t/
COPY demo/ ./demo/
COPY maint/ ./maint/

# Distribution deps. We do NOT use `cpanm --installdeps /src` here on
# purpose: cpanfile pins EV::Pg < 0.03 (the verified line on libpq 15) but
# we deliberately install EV::Pg@0.07 to match the libpq we shipped in
# this image. --installdeps would see the mismatch and try to downgrade.
# Instead we install each dep explicitly at the version we want, and rely
# on cpanm's transitive resolution to pull EV, Future, Moo, SQL::Abstract,
# Test::More, Test::Exception via the dependencies below. See README for
# the cpanfile TODO.
#
# Order matters: install DBIO::PostgreSQL FIRST so its own test deps
# (which include DBD::Pg) never enter cpanm's resolution path for /src.
# Distribution deps. We do NOT use `cpanm --installdeps /src` here on
# purpose: cpanfile pins EV::Pg < 0.03 (the verified line on libpq 15) but
# we deliberately install EV::Pg@0.07 to match the libpq we shipped in
# this image. --installdeps would see the mismatch and try to downgrade.
# Instead we install each dep explicitly at the version we want, and rely
# on cpanm's transitive resolution to pull EV, Future, Moo, SQL::Abstract,
# Test::More, Test::Exception via the dependencies below. See README for
# the cpanfile TODO.
#
# Order matters: install DBIO::PostgreSQL FIRST so its own test deps
# (which include DBD::Pg) never enter cpanm's resolution path for /src.
#
# The wide dep list mirrors DBIO's transitive requirements. Listing them
# explicitly is verbose but makes the image self-contained and survives
# cpanfile changes -- new dependencies added to dbio-postgresql-ev
# are caught by the test run itself (missing-module errors are obvious),
# rather than silently breaking the image build.
RUN cpanm --notest DBIO::PostgreSQL \
    && cpanm --notest EV::Pg@0.07 \
    && cpanm --notest \
         Test::More Test::Exception Test::Deep Test::FailWarnings Test::Fatal \
         Test::LeakTrace Test::Memory::Cycle Test::MockObject Test::Needs \
         Test::NoWarnings Test::Output Test::Requires Test::SubCalls \
         Test::Warn \
         Future EV AnyEvent \
         SQL::Abstract SQL::Abstract::Plugin::InsertReturning \
         Moo MooX::Types::MooseLike MooX::ClassAttribute \
         Moose Role::Tiny \
         Class::Accessor::Grouped Class::C3::Componentised Class::C3 Class::Inspector \
         Class::Load Class::Load::XS Class::Method::Modifiers Class::Tiny \
         Scope::Guard Guard \
         Sub::Name Sub::Identify Sub::Exporter Sub::Install \
         Module::Runtime Module::Pluggable Module::Build \
         Data::OptList Data::Dumper::Concise \
         List::Util List::MoreUtils Params::Util Params::Validate \
         Try::Tiny Carp Carp::Clan Scalar::Util \
         String::RewritePrefix Hash::Merge JSON JSON::PP JSON::XS \
         Devel::GlobalDestruction Devel::StackTrace \
         Time::HiRes IO::Handle IO::Select \
         DBI DBD::Pg \
         aliased B::Hooks::EndOfScope namespace::clean \
         Context::Preserve Hook::LexWrap Attribute::Handlers \
         DateTime DateTime::Format::Pg DateTime::Format::Builder DateTime::Locale \
         Dist::CheckConflicts Module::Find \
         Package::Stash ExtUtils::MakeMaker

# Sanity gate: prove the XS module loads under the same PERL_DL_NONLAZY=1
# that `make test` sets. If this fails, the image is broken and every test
# downstream will look like an EV::Pg bug -- so fail the build loudly here.
#
# The Pg.so path is found via Perl's @INC (cpanm installs to
# /usr/local/lib by default, which is on @INC), not via $Config{archlibexp}
# (which only covers the system Perl tree).
RUN PERL_DL_NONLAZY=1 perl -e 'use EV::Pg; \
    my $so = $INC{"EV/Pg.pm"}; $so =~ s{/Pg\.pm$}{/../auto/EV/Pg/Pg.so}; \
    die "EV::Pg.pm not in %INC" unless $so && -f $so; \
    my $ldd = `ldd $so`; \
    die "EV::Pg.so does not link against /usr/local/lib libpq: $ldd" \
        unless $ldd =~ m{/usr/local/lib/libpq\.so}; \
    my $syms = `nm -D $so`; \
    die "EV::Pg.so missing PQconnectionUsedGSSAPI reference (libpq 16+ symbol)" \
        unless $syms =~ /U\s+PQconnectionUsedGSSAPI/; \
    print "OK: EV::Pg.so links against libpq 17, all required symbols resolved\n"'

# Default: run the whole live test suite. The caller picks the PG instance
# via DBIO_TEST_PG_DSN; tests under t/*-live.t skip themselves when it is
# unset, so the same image is usable for offline lint and online coverage.
#
# EXTRA_LIB_DIR lets the caller mount a directory of in-development Perl
# modules at run time and have it prepended to @INC. The typical case is a
# newer DBIO::PostgreSQL checked out alongside this repo (the version on
# CPAN lags behind and lacks the async_backend hook this distribution's
# live tests rely on). The entrypoint script wires the path into
# PERL5LIB; prove then sees the local checkout first.
ENV EXTRA_LIB_DIR=/extra-lib
COPY maint/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
CMD ["-lr", "t/"]



( run in 1.589 second using v1.01-cache-2.11-cpan-54e63673c56 )