-
-
Notifications
You must be signed in to change notification settings - Fork 11.4k
Conversation
This pr adds a brew for ngrok[1], a tool that allows you to securely expose a local web server to the internet and capture all traffic for detailed inspection and replay. The formula is Go-based and depends on Go, Bazaar, and Mercurial. This formula is a new from-source PR as requested by @MikeMcQuaid on issue 20839 - essentially a resubmission of 23732 which has an unresponsive author. [1]: https://ngrok.com
end | ||
|
||
test do | ||
system "#{bin}/ngrok", "version" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this test be modified to do something more substantial then e.g. --version
or --help
? See cmake.rb
for an example of a formula with a good test. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking for a good example of a Formula for a networking library with a robust test. Tor just does this whole --version
thing too. Will get back to you asap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't found a good example brew test yet. Does simply reading the output of something like ngrok --log=stdout 8080
for the string [client] Tunnel established...
make sense? I don't know if this is more robust than just --version
: we'd then be testing more that the service was up than that ngrok had been installed.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wget
is a good example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, ngrok
is a program that tries to keep open a connection to a remote server, reconnecting as needed. wget
's test confirms that grabbing google.com's index completes as expected (and fails when there's no network connection of course). ngrok
never 'completes'...
One thing we could do is something like Open3.popen3("#{bin}/ngrok -log stdout 8080") do |stdin, stdout, _|
... and in the block check that the first line of stdout is doing something we expect (in this case, reading the config file). https://github.com/Homebrew/homebrew/blob/master/Library/Contributions/example-formula.rb gave me this idea.
Is there a better way to 'test' ngrok is correctly installed? @inconshreveable - thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More discussion on this point here: #23732 (comment)
Was this abandoned? |
@lucasmartins This PR is in a stuck state due to there being neither a consensus nor further good ideas about how to meaningfully test a network program intended to just keep open a tunnel. If you've got good ones, please suggest / implement! I'd love to see ngrok in homebrew :) |
Pushed, sorry for delay here. |
Awesome - thanks! |
Personally, I don't think we need a reliable test to release a experimental version. Although, if we need to check if the recently installed ngrok works I suggest using # ngrok 8080
$ lsof -i -n | grep 'ngrok'
ngrok 2579 lucasmartins 8u IPv4 0xe2544265d8122f89 0t0 TCP 127.0.0.1:yo-main (LISTEN)
ngrok 2579 lucasmartins 10u IPv4 0xe2544265dd319f89 0t0 TCP 192.168.0.113:50677->96.126.125.171:https (ESTABLISHED)
ngrok 2579 lucasmartins 13u IPv4 0xe2544265d81ac771 0t0 TCP 192.168.0.113:50679->96.126.125.171:https (ESTABLISHED) We can also munch this data using $ lsof -i -n | grep 'ngrok'| wc -l
3 Is that acceptable? |
This was merged. |
@lucasmartins I really quite like that idea. You can check those connections (with a munching If you'd like to do a PR to make the test better, that'd be awesome. |
This pr adds a brew for ngrok1, a tool that allows you to securely expose
a local web server to the internet and capture all traffic for detailed
inspection and replay. The formula is Go-based and depends on Go,
Bazaar, and Mercurial.
This formula is a new from-source PR as requested by @MikeMcQuaid on
issue #20839 - essentially a resubmission of #23732 which has an
unresponsive author.