Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minus or underscore in binary name fail process test. #294

Closed
lukasmalkmus opened this issue Oct 1, 2017 · 3 comments
Closed

Minus or underscore in binary name fail process test. #294

lukasmalkmus opened this issue Oct 1, 2017 · 3 comments

Comments

@lukasmalkmus
Copy link

lukasmalkmus commented Oct 1, 2017

I'm using goss and dgoss to test docker container images.

Im using the followingDockerfile to build a small container image for a go binary:

FROM  scratch
LABEL maintainer "..."

COPY --from=build /tmp/myapp-server /bin/myapp-server

EXPOSE     50052
WORKDIR    /myapp
ENTRYPOINT ["/bin/myapp-server"]

This is an excerpt from my goss.yaml file.

process:
  myapp-server:
    running: true

Executing dgoss run ... prints the following:

INFO: Starting docker container
INFO: Container ID: 20b109b0
INFO: Sleeping for 0.2
INFO: Running Tests
Process: myapp-server: running:
Expected
    <bool>: false
to equal
    <bool>: true


Failures/Skipped:

Process: myapp-server: running:
Expected
    <bool>: false
to equal
    <bool>: true

Total Duration: 0.004s
Count: 1, Failed: 1, Skipped: 0
INFO: Deleting container

I actually expected the test to pass. But it fails, if the binary name contains a - or _. A "normal" binary name works fine.

I can think of multiple problems here:

  1. An internal bug in goss
  2. Problems caused by - and _ in yaml identifiers I'm just not aware of it
  3. Problems caused by - and _ in UNIX binary/process names I'm just not aware of it
  4. I fucked up somewhere
@aelsabbahy
Copy link
Member

Odd.

$ cat /tmp/test-fail 
#!/bin/bash

sleep 30s

$ /tmp/test-fail &
[1] 16720

$ goss a process test-fail
Adding Process to './goss.yaml':

test-fail:
  running: true

$ goss validate
.

Total Duration: 0.005s
Count: 1, Failed: 0, Skipped: 0
$ kill %1
$ goss validate
F

Failures/Skipped:

Process: test-fail: running:
Expected
    <bool>: false
to equal
    <bool>: true

Total Duration: 0.006s
Count: 1, Failed: 1, Skipped: 0
[1]+  Terminated              /tmp/test-fail

I also tried a Dockerfile with a simple go program that just sleeps for 30 seconds:

$ cat Dockerfile 
FROM  alpine
LABEL maintainer "..."

COPY ./myapp-server /bin/myapp-server

ENTRYPOINT ["/bin/myapp-server"]

$ dgoss edit delete_me:latest
INFO: Starting docker container
INFO: Container ID: 03cc741e
INFO: Run goss add/autoadd to add resources
/goss # goss a process myapp-server
Adding Process to './goss.yaml':

myapp-server:
  running: true


/goss # exit
INFO: Copied '/goss/goss.yaml' from container to '.'
INFO: Deleting container

$ dgoss run delete_me:latest
INFO: Starting docker container
INFO: Container ID: 1f646ee3
INFO: Sleeping for 0.2
INFO: Running Tests
Process: myapp-server: running: matches expectation: [true]


Total Duration: 0.001s
Count: 1, Failed: 0, Skipped: 0
INFO: Deleting container

Have you tried:

  1. The above doesn't prove this to be not true, your case might be more unique. Also, I couldn't use from scratch since dgoss runs sh
  2. I think the above rules this out
  3. Did you try without - or _?
  4. Nah, but I wonder if scratch is throwing things off. Goss uses the /proc filesystem to see whats there.

Try it with alpine instead of scratch and see what the output of ps -ef shows.

@deftdawg
Copy link

deftdawg commented Jun 4, 2019

Wonder if there is any relation to #451... systemd-journald fails in that case, however systemd-logind, and systemd-udevd do work.

@aelsabbahy
Copy link
Member

Closed, tracking this in #451

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants