Skip to content

Test fails in a Docker build of a Cro service #74

@greenfork

Description

@greenfork

I have a Cro service and a docker file. For some reason tests for this library fail. I also don't seem to understand which test exactly fails. below are files and docker output. Anything I can try to debug the issue?

Reproduction:

  1. Create a file service.raku with the content below.
  2. Create a file Dockerfile with the content below.
  3. Run docker build -t cro .
# service.raku
use Cro::HTTP::Log::File;
use Cro::HTTP::Server;
use Cro::HTTP::Router;

sub routes() is export {
    route {
        get -> {
            content 'text/html', '';
        }
        get 'user', -> $id {
            contents 'text/html', $id;
        }
        post 'user', -> {
            content 'text/html', '';
        }
    }
}

my Cro::Service $http = Cro::HTTP::Server.new(
    :http<1.1>,
    :host<localhost>,
    :port<3000>,
    application => routes(),
    after => [
        Cro::HTTP::Log::File.new(logs => $*OUT, errors => $*ERR)
    ]
);

$http.start;

say 'Listening at http://localhost:3000';

react {
    whenever signal(SIGINT) {
        say 'Shutting down...';
        $http.stop;
        done;
    }
}

Dockerfile:

FROM rakudo-star:2024.02
RUN apt-get update -qq
RUN apt-get -qy install --no-install-recommends build-essential libssl-dev openssl
RUN mkdir /app
COPY . /app
WORKDIR /app
RUN zef install --deps-only --debug .
RUN raku -c service.raku
EXPOSE 3000
CMD raku service.raku

Fails with:

===> Testing: IO::Socket::Async::SSL:ver<0.7.14>:auth<zef:jnthn>
[IO::Socket::Async::SSL] Testing with plugin: Zef::Service::TAP
[IO::Socket::Async::SSL] ok 1 - Sending non-SSL to SSL socket does not hang (connection closed)
[IO::Socket::Async::SSL] ok 2 - No connection emitted
[IO::Socket::Async::SSL] ok 3 - Server tap did not QUIT on bad incoming connection
[IO::Socket::Async::SSL] 1..3
[IO::Socket::Async::SSL] t/bad-incoming.t ... ok
[IO::Socket::Async::SSL] ok 1 - Connection fails when the are non-matching cipher expectations
[IO::Socket::Async::SSL] ok 2 - Connection ok when ciphers match up
[IO::Socket::Async::SSL] 1..2
[IO::Socket::Async::SSL] t/ciphers.t ........ ok
[IO::Socket::Async::SSL] ok 1 - listen method returns a Supply
[IO::Socket::Async::SSL] ok 2 - Server not listening until Supply is tapped
[IO::Socket::Async::SSL] ok 3 - Server listens after Supply is tapped
[IO::Socket::Async::SSL] ok 4 - Can establish and SSL connection to the SSL server
[IO::Socket::Async::SSL] ok 5 - Can write to the SSL server
[IO::Socket::Async::SSL] ok 6 - Can get a Supply of incoming data
[IO::Socket::Async::SSL] ok 7 - SSL echo server got back expected data
[IO::Socket::Async::SSL] ok 8 - Can close the SSL server connection
[IO::Socket::Async::SSL] # Subtest: Without specifying a CA, our self-signed server fails verification
[IO::Socket::Async::SSL]     1..2
[IO::Socket::Async::SSL]     ok 1 - code dies
[IO::Socket::Async::SSL]     ok 2 - right exception type (X::IO::Socket::Async::SSL::Verification)
[IO::Socket::Async::SSL] ok 9 - Without specifying a CA, our self-signed server fails verification
[IO::Socket::Async::SSL] ok 10 - Server not listening after tap is closed
[IO::Socket::Async::SSL] # Subtest: When we connect to 127.0.0.1, certificate for localhost will not do
[IO::Socket::Async::SSL]     1..2
[IO::Socket::Async::SSL]     ok 1 - code dies
[IO::Socket::Async::SSL]     ok 2 - right exception type (X::IO::Socket::Async::SSL::Verification)
[IO::Socket::Async::SSL] ok 11 - When we connect to 127.0.0.1, certificate for localhost will not do
[IO::Socket::Async::SSL] ok 12 - socket-host works
[IO::Socket::Async::SSL] ok 13 - Simple server-side ALPN works
[IO::Socket::Async::SSL] ok 14 - Passed protocols are correct
[IO::Socket::Async::SSL] ok 15 - Server-side ALPN with a subroutine works
[IO::Socket::Async::SSL] ok 16 - ALPN on server-side is set
[IO::Socket::Async::SSL] ok 17 - ALPN on server-side is set
Aborting due to test failure: IO::Socket::Async::SSL:ver<0.7.14>:auth<zef:jnthn> (use --force-test to override)
[IO::Socket::Async::SSL] ok 18 - Multiple clients with ALPN work
[IO::Socket::Async::SSL] ok 19 - Multiple clients with ALPN work
[IO::Socket::Async::SSL] ok 20 - Negotiation is correct (1)
[IO::Socket::Async::SSL] ok 21 - Negotiation is correct (2)
[IO::Socket::Async::SSL] ok 22 - listen method returns a Supply with PKCS12 bundle
[IO::Socket::Async::SSL] t/client-server.t .. Dubious, test returned 1
[IO::Socket::Async::SSL] All 22 subtests passed
[IO::Socket::Async::SSL] ok 1 - Connection with cipher doing key exchange works
[IO::Socket::Async::SSL] 1..1
[IO::Socket::Async::SSL] t/dh-ciphers.t ..... ok
[IO::Socket::Async::SSL] ok 1 - Connection with cipher doing key exchange works
[IO::Socket::Async::SSL] 1..1
[IO::Socket::Async::SSL] t/ecdh-ciphers.t ... ok
[IO::Socket::Async::SSL] ok 1 - UTF-8 decoding with bytes over boundaries correctly handled
[IO::Socket::Async::SSL] 1..1
[IO::Socket::Async::SSL] t/encoding.t ....... ok
[IO::Socket::Async::SSL] ok 1 - Thread stress-test lived
[IO::Socket::Async::SSL] 1..1
[IO::Socket::Async::SSL] t/thread-stress.t .. ok
[IO::Socket::Async::SSL] ok 1 - Got expected upgrade response
[IO::Socket::Async::SSL] ok 2 - Got upgraded connection on client side
[IO::Socket::Async::SSL] ok 3 - Got correct message from upgraded connection
[IO::Socket::Async::SSL] 1..3
[IO::Socket::Async::SSL] t/upgrade.t ........ ok
[IO::Socket::Async::SSL] All tests successful.
[IO::Socket::Async::SSL]
[IO::Socket::Async::SSL] Test Summary Report
[IO::Socket::Async::SSL] -------------------
[IO::Socket::Async::SSL] t/client-server.t (Wstat: 256 Tests: 22 Failed: 0)
[IO::Socket::Async::SSL] Non-zero exit status: 1
[IO::Socket::Async::SSL]   Parse errors: No plan found in TAP output
[IO::Socket::Async::SSL] Files=8, Tests=34,  17 wallclock secs
[IO::Socket::Async::SSL] Result: FAILED
===> Testing [FAIL]: IO::Socket::Async::SSL:ver<0.7.14>:auth<zef:jnthn>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions