Giter Club home page Giter Club logo

Comments (4)

outofcoffee avatar outofcoffee commented on June 16, 2024

Hi @LukasKnuth, thanks for raising this.

Yes, you can use the /system/status healthcheck endpoint which returns HTTP 200 when the server is up.

For additional binaries inside the container, here's an example of a custom Docker image https://github.com/outofcoffee/imposter/blob/main/examples/docker/Dockerfile

☝️ This example extends from the Java base image so has its various userspace tools available (and more you can install with the package manager).

from imposter.

outofcoffee avatar outofcoffee commented on June 16, 2024

For this part of your question:

Would you be open to adding a CLI option to the server to check if its up and ready?

You should be able to use this command with the CLI:

imposter list --exit-code-health

You can also use the short form of the --exit-code-health argument, -x
More info here.

This sets the exit code based on mock health.

Example

$ imposter list -x ; echo $?
| ID | NAME | PORT | HEALTH |
|----|------|------|--------|
1

☝️ Returns code 1 as no mocks running.

$ imposter list -x ; echo $?
|      ID      |     NAME     | PORT | HEALTH  |
|--------------|--------------|------|---------|
| d5755b211011 | /brave_mayer | 8080 | healthy |
0

☝️ Returns code 0 as a healthy mock running.

from imposter.

LukasKnuth avatar LukasKnuth commented on June 16, 2024

Nice, thanks for getting back to me. I wasn't aware that this existed already, thats great!

from imposter.

LukasKnuth avatar LukasKnuth commented on June 16, 2024

I tested it with my setup now and for me, this doesn't seem to work as expected:

$ docker exec e2e-apiv1-1 imposter list -x
| ID | NAME | PORT | HEALTH  |
|----|------|------|---------|
|  1 | java |    0 | unknown |
$ echo $?
1

I use the openapi plugin for this. Everything in the mock works as expected, just the list returns the unknown health status. Do I need to add any additional information to the configuration for imposter ls to pick it up and/or it's health?

from imposter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.