Make it possible to test node_redis in a Docker environment #788
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is an ongoing effort in the official Node.JS Build and Test Working Group nodejs/smoke-test#1 to be able to test popular NPM packages as a part of the official test suite and continuous integration for Node.JS. The goal here is to more quickly identify what breaks when, giving core developers important feedback on new features, and package authors an early warning and time to roll out new compatible versions with new Node.JS releases. We believe this effort will contribute to make the overall experience of using Node.JS better.
Testing drivers are particularly challenging; but equally important, since they rely on external dependencies that Node.JS does not control. We are proposing a test infrastructure composed of Docker containers which allows us to create all the different external dependencies in a easy, reproducible, and secure way; you can follow that effort here nodejs/smoke-test#3.
What we need from the drivers is that they 1) do not assume that the test suite is running on the same machine as the services they are dependent upon; 2) that we can in some way configure host and corresponding port variables to point to the external service.
When we run the
node_redis
test suite in the following way:… Docker creates two environment variables to the linked Redis service:
REDIS_PORT_6379_TCP_ADDR
- address of the linked redis serviceREDIS_PORT_6379_TCP_PORT
- port of the linked redis serviceI have made three modifications to the test suite to get it working with the Docker setup described above:
REDIS_PORT_6379_TCP_ADDR
andREDIS_PORT_6379_TCP_PORT
before setting default values toHOST
andPORT
variables (d34dcc8) (da535a6)HOST
andPORT
variables when creating new redis clients in the test suite to prevent clients from connecting to127.0.0.1
which seams to be the default if no host is provided (8b5ce10)