stubby: update plist to use new YAML config file

and update the test block to use a YAML config file.

Closes #19507.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
This commit is contained in:
Sara Dickinson 2017-10-16 15:26:18 +01:00 committed by ilovezfs
parent 9e48fb6621
commit 3cbb4566d1

View file

@ -3,6 +3,7 @@ class Stubby < Formula
homepage "https://getdnsapi.net/blog/dns-privacy-daemon-stubby/"
url "https://github.com/getdnsapi/stubby/archive/v0.1.3.tar.gz"
sha256 "5f20659945696647f7c3f4a090ffc8bf1d96e69a751bbf36e3cddb584846602e"
revision 1
head "https://github.com/getdnsapi/stubby.git", :branch => "develop"
bottle do
@ -26,7 +27,7 @@ class Stubby < Formula
system "make", "install"
end
plist_options :startup => true, :manual => "sudo stubby -C #{HOMEBREW_PREFIX}/etc/stubby/stubby.conf"
plist_options :startup => true, :manual => "sudo stubby -C #{HOMEBREW_PREFIX}/etc/stubby/stubby.yml"
def plist; <<-EOS.undent
<?xml version="1.0" encoding="UTF-8"?>
@ -43,7 +44,7 @@ class Stubby < Formula
<array>
<string>#{opt_bin}/stubby</string>
<string>-C</string>
<string>#{etc}/stubby/stubby.conf</string>
<string>#{etc}/stubby/stubby.yml</string>
<string>-l</string>
</array>
<key>StandardErrorPath</key>
@ -56,22 +57,25 @@ class Stubby < Formula
end
test do
(testpath/"stubby_test.conf").write <<-EOS.undent
{ resolution_type: GETDNS_RESOLUTION_STUB
, dns_transport_list: [ GETDNS_TRANSPORT_TLS, GETDNS_TRANSPORT_UDP, GETDNS_TRANSPORT_TCP ]
, listen_addresses: [ 127.0.0.1@5553]
, idle_timeout: 0
, upstream_recursive_servers:
[ { address_data: 145.100.185.15},
{ address_data: 145.100.185.16},
{ address_data: 185.49.141.37}
]
}
assert_predicate etc/"stubby/stubby.yml", :exist?
(testpath/"stubby_test.yml").write <<-EOS.undent
resolution_type: GETDNS_RESOLUTION_STUB
dns_transport_list:
- GETDNS_TRANSPORT_TLS
- GETDNS_TRANSPORT_UDP
- GETDNS_TRANSPORT_TCP
listen_addresses:
- 127.0.0.1@5553
idle_timeout: 0
upstream_recursive_servers:
- address_data: 145.100.185.15
- address_data: 145.100.185.16
- address_data: 185.49.141.37
EOS
output = shell_output("#{bin}/stubby -i -C stubby_test.conf")
output = shell_output("#{bin}/stubby -i -C stubby_test.yml")
assert_match "bindata for 145.100.185.15", output
pid = fork do
exec "#{bin}/stubby", "-C", testpath/"stubby_test.conf"
exec "#{bin}/stubby", "-C", testpath/"stubby_test.yml"
end
begin
sleep 2