Comments (3)
I've faced the same issue, and I agree that it would be nice to have built-in support for this use case in container-structure-test.
As a workaround, if available in the image, I've used the Linux timeout
command to set a maximum duration for the command under test. It's a bit of a hack, but it works.
Something like that should do the trick:
command: "timeout"
args:
- --preserve-status
- 3s
- docker-entrypoint.sh postgres
from container-structure-test.
Logging is typically done through stderr. The expectedError
field in the command test should allow you to perform a regex match over the stderr output.
Command tests have to run to completion in order to capture its state of the test container that is created from the image. You will need to invoke your process (psql, it looks like?) in a way that runs to completion. Perhaps you can run the server process as a daemon/background process, get the PID then immediately send a kill -INT
signal as part of your test?
from container-structure-test.
Thanks! The log can be redirected somehow through the stderr
.
However, I don't think I can run the server process in background through this tool. I was wondering if it could be possible leveraging the setup
field but I see that the function delegates the process invocation to the ProcessCommand
, which waits for the command to exit.
from container-structure-test.
Related Issues (20)
- Testing the existence of a directory is very slow
- Release process: use github actions and release to bazel central registry HOT 1
- container-structure-test behaves differently on two identical machines HOT 2
- How to use container_structure_test with oci_image on MacOS
- No Release asset checksums (sha256) since Release v1.11.0
- Add platform parameter to support testing multi-platform images
- Multiple outputs (i.e. `text` and `json`) HOT 1
- New Testcontainers driver HOT 3
- Env var expansion feature in commandTests output assertions
- Add support to containerRunOptions for --cap-drop
- Security Policy violation SECURITY.md HOT 140
- Update documentation regarding Bazel and Docker TCP connections
- Binaries for v1.16.1? HOT 2
- Unable use v1.16.1 with bzlmod
- How to mount a config file? HOT 1
- Hash for linux_i386 is missing
- Add Darwin ARM64 package type HOT 7
- Add ability to document container in markdown HOT 1
- Add a metadata test to test the base image used in the image
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from container-structure-test.