newman
newman copied to clipboard
Not able to run the Postman as Job in kubernetes
Version and environment information: -->
- Newman Version (can be found via
newman -v
): 5.3.0 - OS details (type, version, and architecture): minikube version: v1.17.0
- Are you using Newman as a library, or via the CLI? CLI
- Did you encounter this recently, or has this bug always been there: I am using it newly
- Expected behaviour: Test result should come
- Command / script used to run Newman:
Kubectl apply -f newman.yml
newman.yml -:
apiVersion: batch/v1 kind: Job metadata: name: api-tests namespace: default spec: parallelism: 1 template: metadata: name: api-tests spec: containers: - name: api-tests image: postman/newman command: ["run"] args: ["./VS-workspace/contract-tests-postman.yml","--reporters","cli","--reporter-cli-no-failures"] restartPolicy: Never
Error -: Warning Failed 39s kubelet Error: failed to start container "api-tests": Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "run": executable file not found in $PATH: unknown
Hi @uttamanand-whs Not sure if you solved this issue already but have you heard about Testkube ? It allows you to run your postman tests in Kubernetes without needing to use newman or configuring any docker image. Feel free to give it a shot! In case there's something missing for you, feel free to open an issue for it. I'm someone deeply involved in that project and I'll be able to help you :)
@uttamanand-whs did you solve this? I am having the same issue when trying to run newman as a job in kubernetes
This is not a bug. Please refer to this answer: https://stackoverflow.com/a/49657024/4699073
To quote:
Kubernetes provides us with multiple options on how to use these commands: When you override the default Entrypoint and Cmd in Kubernetes .yaml file, these rules apply:
- If you do not supply command or args for a Container, the defaults defined in the Docker image are used.
- If you supply only args for a Container, the default Entrypoint defined in the Docker image is run with the args that you supplied.
- If you supply a command for a Container, only the supplied command is used. The default EntryPoint and the default Cmd defined in the Docker image are ignored. Your command is run with the args supplied (or no args if none supplied).
Refer to the following example:
apiVersion: batch/v1
kind: Job
metadata:
name: job-1
spec:
template:
metadata:
name: job-1
spec:
containers:
- name: newman
image: postman/newman:alpine
imagePullPolicy: IfNotPresent
args: ["run", "-h"]
restartPolicy: OnFailure
Since the command "newman" is already set as the entrypoint in the Dockerfile, you only need to provide arguments here
Closing this issue, please feel free to reopen if this doesn't solve the problem