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

dgoss add port in tomcat images shows not listening even though the port is listening #215

Closed
frezbo opened this issue Mar 28, 2017 · 12 comments

Comments

@frezbo
Copy link

frezbo commented Mar 28, 2017

docker pull tomcat:alpine
dgoss edit -p 8080:8080 tomcat:alpine
INFO: Starting docker container
INFO: Container ID: de8ef54c
INFO: Run goss add/autoadd to add resources
/goss # goss add port 8080
Adding Port to './goss.yaml':

tcp:8080:
  listening: false
  ip: []


/goss # netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 :::8080                 :::*                    LISTEN      1/java
tcp        0      0 ::ffff:127.0.0.1:8005   :::*                    LISTEN      1/java
tcp        0      0 :::8009                 :::*                    LISTEN      1/java
/goss # wget http://localhost:8080
Connecting to localhost:8080 (127.0.0.1:8080)
index.html           100% |*******************************| 11230   0:00:00 ETA
/goss # 

@aelsabbahy
Copy link
Member

This is the same issue described in #149, it should work fine if you do goss add port tcp6:8080

@frezbo
Copy link
Author

frezbo commented Mar 28, 2017

@aelsabbahy thanks, but will this be fixed?

@aelsabbahy
Copy link
Member

I definitely want it fixed, but haven't spent the time trying figure out the best way to do this.

netstat doesn't handle it, but ss does. So I probably need to dig into the ss code to see how it handles this.

@aelsabbahy
Copy link
Member

Hmm, just reread your netstat output. Wonder if it was an older version of netstat that would show tcp6.

@frezbo
Copy link
Author

frezbo commented Mar 28, 2017

Maybe as I am using alpine I am not able to see the version. This is the busybox version

BusyBox v1.25.1 (2016-10-26 16:15:20 GMT) multi-call binary.

@pysysops
Copy link
Contributor

I don't mind having a look at this one (as there's a few open issues for it) before I re-visit the HTTP headers / gomega attempt.

@aelsabbahy
Copy link
Member

Sure. For what it's worth, netstat on busybox looks like a dead end.

Think it prints "tcp" for both tcp and tcp6:
http://code.metager.de/source/xref/busybox/networking/netstat.c

Sort of, kind of, maybe related (Or not, but interesting read):
golang/go#1854

I think ss handles this correctly, but I haven't verified it or figured out why.

More interesting read: https://tools.ietf.org/html/rfc3493#section-3.7

@aelsabbahy
Copy link
Member

I might be over complicating this.. maybe there's a simple solution.. I'm not as familiar with the subject, so take everything I'm saying as assumptions :)

Thanks btw. Also, there's another PR from a contributor that might do the header gomega marcher (it's a marchers for sub-maps).. I'll keep you updated.

@aelsabbahy
Copy link
Member

Random thought.. maybe it would be simpler to get rid of the whole tcp: vs tcp6: thing all together.

We can collapse the tests into two categories: tcp (default) and udp, if the user wants to make more specific assertions, they can use the ip: attribute.

The only downside is if a user wants to test one or the other, it would be an awkward syntax:

port:
  tcp:22:
    listening: true
    ip:
      and:
      - not:
          contain-element: '::'
      - contain-element: 0.0.0.0

Thoughts on this approach? I'm just thinking out-loud on this.. not 100% sure it's a good idea yet.

@frezbo
Copy link
Author

frezbo commented Mar 29, 2017

Thanks

@frezbo
Copy link
Author

frezbo commented Mar 29, 2017

@aelsabbahy the above code might hinder with the simplicity of the goss syntax, just a suggestion

@aelsabbahy
Copy link
Member

I'm gonna close this as a duplicate of #149 so we have one location to track this

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

No branches or pull requests

3 participants