feat: ✨ Created a mini nodeJS server with NewMan for testing without PostMan GUI.
This will mimic a run in a CD/CI environment or docker container.
This commit is contained in:
40
node_modules/newman/docker/images/ubuntu1404/Dockerfile
generated
vendored
Normal file
40
node_modules/newman/docker/images/ubuntu1404/Dockerfile
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
FROM ubuntu:14.04.2
|
||||
LABEL maintainer="Postman Labs <help@postman.com>"
|
||||
|
||||
ARG NODE_VERSION=10
|
||||
ARG NEWMAN_VERSION
|
||||
|
||||
# Bail out early if NODE_VERSION is not provided
|
||||
RUN if [ ! $(echo $NEWMAN_VERSION | grep -oE "^[0-9]+\.[0-9]+\.[0-9]+$") ]; then \
|
||||
echo "\033[0;31mA valid semver Newman version is required in the NEWMAN_VERSION build-arg\033[0m"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# Install node
|
||||
ADD https://deb.nodesource.com/setup_$NODE_VERSION.x /opt/install_node.sh
|
||||
|
||||
RUN bash /opt/install_node.sh && \
|
||||
apt-get install -y nodejs && \
|
||||
npm install -g newman@${NEWMAN_VERSION} && \
|
||||
rm /opt/install_node.sh;
|
||||
|
||||
# Set environment variables
|
||||
ENV LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8"
|
||||
|
||||
# Set workdir to /etc/newman
|
||||
# When running the image, mount the directory containing your collection to this location
|
||||
#
|
||||
# docker run -v <path to collections directory>:/etc/newman ...
|
||||
#
|
||||
# In case you mount your collections directory to a different location, you will need to give absolute paths to any
|
||||
# collection, environment files you want to pass to newman, and if you want newman reports to be saved to your disk.
|
||||
# Or you can change the workdir by using the -w or --workdir flag
|
||||
WORKDIR /etc/newman
|
||||
|
||||
# Set newman as the default container command
|
||||
# Now you can run the container via
|
||||
#
|
||||
# docker run -v /home/collections:/etc/newman -t postman/newman_ubuntu1404 run YourCollection.json.postman_collection \
|
||||
# -e YourEnvironment.postman_environment \
|
||||
# -H newman_report.html
|
||||
ENTRYPOINT ["newman"]
|
39
node_modules/newman/docker/images/ubuntu1404/README.md
generated
vendored
Normal file
39
node_modules/newman/docker/images/ubuntu1404/README.md
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# newman_ubuntu1404 (deprecated)
|
||||
## Use postman/newman:ubuntu instead. See https://hub.docker.com/r/postman/newman/ for more available tags
|
||||
|
||||
This image runs newman on node v10 on Ubuntu 14.04.2
|
||||
|
||||
Build the image,
|
||||
|
||||
```terminal
|
||||
docker build -t postman/newman_ubuntu1404 --build-arg NEWMAN_VERSION="full semver version" .
|
||||
```
|
||||
|
||||
Or get it from [docker hub](https://registry.hub.docker.com/u/postman/newman_ubuntu1404/)
|
||||
|
||||
```terminal
|
||||
docker pull postman/newman_ubuntu1404
|
||||
```
|
||||
|
||||
then run it
|
||||
|
||||
```terminal
|
||||
docker --volume="/home/postman/collections:/etc/newman" -t postman/newman_ubuntu1404 run JSONBlobCoreAPI.json.postman_collection -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
For newman-docker to be able to use collections and environment files saved on the host machine, and to save reports generated by newman, a directory containing the collection and environment needs to be mounted on to the docker instance on run time, preferably at `/etc/newman`, which is the default working directory. If you mount to a different location, then
|
||||
- You can either pass the full path to your collection and environment files to newman. For instance, if you mount to `/etc/newman`,
|
||||
|
||||
```terminal
|
||||
docker --volume="/home/postman/collection:/etc/newman" -t postman/newman_ubuntu1404 run JSONBlobCoreAPI.json.postman_collection -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
- You can change the working directory while running the image to the location you mounted to, using the `-w` or `--workdir` flag.
|
||||
|
||||
```terminal
|
||||
docker run --volume="/home/postman/collections:/etc/newman" -t postman/newman_ubuntu1404 run JSONBlobCoreAPI.json.postman_collection -r json --reporter-json-export newman-report.json
|
||||
```
|
||||
|
||||
In case you don't need to save newman's report to the host, and your collection is available online and it does not require any environment, then you can forgo mounting your collections directory, and directly pass the collection url to newman
|
||||
|
||||
```terminal
|
||||
docker run -t postman/newman_ubuntu1404 run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda
|
||||
```
|
Reference in New Issue
Block a user