test/test_truncation.rb in rubydns-0.7.3 vs test/test_truncation.rb in rubydns-0.8.0
- old
+ new
@@ -18,26 +18,29 @@
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-require 'helper'
-require 'pathname'
+require 'minitest/autorun'
require 'rubydns'
-require 'rubydns/resolver'
require 'rubydns/extensions/string'
-class TruncatedServer < RExec::Daemon::Base
+require 'process/daemon'
+
+class TruncatedServer < Process::Daemon
SERVER_PORTS = [[:udp, '127.0.0.1', 5320], [:tcp, '127.0.0.1', 5320]]
@@base_directory = File.dirname(__FILE__)
-
- Name = Resolv::DNS::Name
+
+ def working_directory
+ File.join(__dir__, "tmp")
+ end
+
IN = Resolv::DNS::Resource::IN
-
- def self.run
+
+ def startup
# RubyDNS::log_bad_messages!("bad.log")
# Start the RubyDNS server
RubyDNS::run_server(:listen => SERVER_PORTS) do
match("truncation", IN::TXT) do |transaction|
@@ -51,23 +54,29 @@
end
end
end
end
-class TruncationTest < Test::Unit::TestCase
+class TruncationTest < MiniTest::Test
def setup
+ TruncatedServer.controller output: File.open("/dev/null", "w")
+
TruncatedServer.start
end
def teardown
TruncatedServer.stop
end
+ IN = Resolv::DNS::Resource::IN
+
def test_tcp_failover
resolver = RubyDNS::Resolver.new(TruncatedServer::SERVER_PORTS)
EventMachine::run do
resolver.query("truncation", IN::TXT) do |response|
+ refute_kind_of RubyDNS::ResolutionFailure, response
+
text = response.answer.first
assert_equal "Hello World! " * 100, text[2].strings.join
EventMachine::stop