Skip to content

Add OutputStream and ErrorStream to dockertest.BuildOptions #629

@pellared

Description

@pellared

Preflight checklist

Ory Network Project

No response

Describe your problem

If BuildAndRunWithBuildOptions fails because of a problem during building a docker image then the error is not always helpful e.g.

The command '/bin/sh -c go build -o rolldice main.go' returned a non-zero code:

Describe your ideal solution

It would be easier if it is possible to set the output and error streams directly on BuildOptions.

Workarounds or alternatives

To mitigate it I use pool.Client.BuildImage where I set OutputStream and ErrorStream to t.Output() and then I call pool.RunWithOptions. Then I get can get following test output:

 ...
 ./main.go:160:20: syntax error: unexpected name c at end of statement
    
    http_go_otel_test.go:149: 
                Error Trace:    /home/ropajak/repos/opentelemetry-ebpf-instrumentation/internal/test/integration/http_go_otel_test.go:149
                Error:          Received unexpected error:
                                The command '/bin/sh -c go build -o rolldice main.go' returned a non-zero code: 1
                Test:           TestHTTPGoOTelInstrumentedApp
                Messages:       could not build test server Docker image

Version

v3.12.0

Additional Context

Thank you for this library. I love it!

If you want I can try addressing the issue myself given it is accepted.

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