goss-org / goss

Quick and Easy server testing/validation
https://goss.rocks
Apache License 2.0
5.5k stars 470 forks source link

test python package issue while use pip #801

Closed spham closed 10 months ago

spham commented 1 year ago

I am encountering a problem while attempting to verify if a Python package, "patroni," is installed. I tried using the goss add command "patroni --version" command, which produced the following results:

As a non-root user:

command: 
  patroni --version:
    exit-status: 0
    stdout:
    - patroni 3.0.0
    stderr: []
    timeout: 10000

As the root user:

command:
  patroni --version:
    exit-status: 127
    stdout: []
    stderr:
    - 'sh: patroni: command not found'
    timeout: 10000

The "patroni" package was installed using the command python3 -m pip install patroni by a specific user. However, it appears that the goss testing tool does not have a specific method for testing packages installed with pip. This is the issue I am facing while running ansible goss tests.

How to have same behaviour like package command ? it's work on all cases

aelsabbahy commented 1 year ago

If you're the root user and not using Goss, can you run "patroni --version"? If you can't and see the same error when using Goss, then Goss is working properly.

Assuming the above is correct, take a look at the suggestions in this issue: https://github.com/goss-org/goss/issues/600#issue-655007554

aelsabbahy commented 10 months ago

Hello, did the above address your question?

aelsabbahy commented 10 months ago

closing ticket, feel free to open a new issue if this is still a problem