-
-
Notifications
You must be signed in to change notification settings - Fork 62
support for search options in /etc/resolv.conf #199
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
Changes from 9 commits
fa1684d
54ed2cf
1a1b72d
0ba2010
2202726
38c9526
23cb5e6
8980bdd
b3e980a
e675f09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,9 +38,9 @@ public function testResolveAllLocalhostResolvesWithArray() | |
| /** | ||
| * @group internet | ||
| */ | ||
| public function testResolveGoogleResolves() | ||
| public function testResolveBingResolves() | ||
| { | ||
| $promise = $this->resolver->resolve('google.com'); | ||
| $promise = $this->resolver->resolve('bing.com'); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see why we should change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In China,we can not visit google.com, so tests will not pass on my computer,But bing.com we can
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with you that we should use something that works for everyone, in some of our projects we started using What do you think?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SimonFrings IMHO it makes sense to change everything to @Chrisdowson I assume you can reacht
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes,I can reach
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I agree with WyriHaximus, How about I replace
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WyriHaximus @Chrisdowson I agree with both of you, I am not sure if this is something we should tackle in this pull request as it doesn't fit to the other changes made in here and could seem a bit random. It also keeps the diff significantly smaller and lays focus on the actual changes. That's the reason I suggest a (follow-up) pull request where we change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SimonFrings @Chrisdowson just opened reactphp/event-loop#263 to kick off the discussion. |
||
| $promise->then($this->expectCallableOnce(), $this->expectCallableNever()); | ||
|
|
||
| Loop::run(); | ||
|
|
@@ -49,12 +49,12 @@ public function testResolveGoogleResolves() | |
| /** | ||
| * @group internet | ||
| */ | ||
| public function testResolveGoogleOverUdpResolves() | ||
| public function testResolveBingleOverUdpResolves() | ||
| { | ||
| $factory = new Factory(); | ||
| $this->resolver = $factory->create('udp://8.8.8.8'); | ||
|
|
||
| $promise = $this->resolver->resolve('google.com'); | ||
| $promise = $this->resolver->resolve('bing.com'); | ||
| $promise->then($this->expectCallableOnce(), $this->expectCallableNever()); | ||
|
|
||
| Loop::run(); | ||
|
|
@@ -63,12 +63,12 @@ public function testResolveGoogleOverUdpResolves() | |
| /** | ||
| * @group internet | ||
| */ | ||
| public function testResolveGoogleOverTcpResolves() | ||
| public function testResolveBingOverTcpResolves() | ||
| { | ||
| $factory = new Factory(); | ||
| $this->resolver = $factory->create('tcp://8.8.8.8'); | ||
|
|
||
| $promise = $this->resolver->resolve('google.com'); | ||
| $promise = $this->resolver->resolve('bing.com'); | ||
| $promise->then($this->expectCallableOnce(), $this->expectCallableNever()); | ||
|
|
||
| Loop::run(); | ||
|
|
@@ -77,25 +77,25 @@ public function testResolveGoogleOverTcpResolves() | |
| /** | ||
| * @group internet | ||
| */ | ||
| public function testResolveAllGoogleMxResolvesWithCache() | ||
| public function testResolveAllBingMxResolvesWithCache() | ||
| { | ||
| $factory = new Factory(); | ||
| $this->resolver = $factory->createCached('8.8.8.8'); | ||
|
|
||
| $promise = $this->resolver->resolveAll('google.com', Message::TYPE_MX); | ||
| $promise = $this->resolver->resolveAll('bing.com', Message::TYPE_MX); | ||
| $promise->then($this->expectCallableOnceWith($this->isType('array')), $this->expectCallableNever()); | ||
|
|
||
| Loop::run(); | ||
| } | ||
| /** | ||
| * @group internet | ||
| */ | ||
| public function testResolveAllGoogleCaaResolvesWithCache() | ||
| public function testResolveAllbingCaaResolvesWithCache() | ||
| { | ||
| $factory = new Factory(); | ||
| $this->resolver = $factory->createCached('8.8.8.8'); | ||
|
|
||
| $promise = $this->resolver->resolveAll('google.com', Message::TYPE_CAA); | ||
| $promise = $this->resolver->resolveAll('bing.com', Message::TYPE_CAA); | ||
| $promise->then($this->expectCallableOnceWith($this->isType('array')), $this->expectCallableNever()); | ||
|
|
||
| Loop::run(); | ||
|
|
@@ -114,19 +114,21 @@ public function testResolveInvalidRejects() | |
| $promise->then(null, function ($reason) use (&$exception) { | ||
| $exception = $reason; | ||
| }); | ||
|
|
||
| /** @var \React\Dns\RecordNotFoundException $exception */ | ||
| $this->assertInstanceOf('React\Dns\RecordNotFoundException', $exception); | ||
| $this->assertEquals('DNS query for example.invalid (A) returned an error response (Non-Existent Domain / NXDOMAIN)', $exception->getMessage()); | ||
| $this->assertEquals(Message::RCODE_NAME_ERROR, $exception->getCode()); | ||
| $config = \React\Dns\Config\Config::loadSystemConfigBlocking(); | ||
| if (!count($config->searches)) { | ||
| /** @var \React\Dns\RecordNotFoundException $exception */ | ||
| $this->assertInstanceOf('React\Dns\RecordNotFoundException', $exception); | ||
| $this->assertEquals('DNS query for example.invalid (A) returned an error response (Non-Existent Domain / NXDOMAIN)', $exception->getMessage()); | ||
| $this->assertEquals(Message::RCODE_NAME_ERROR, $exception->getCode()); | ||
| } | ||
| } | ||
|
|
||
| public function testResolveCancelledRejectsImmediately() | ||
| { | ||
| // max_nesting_level was set to 100 for PHP Versions < 5.4 which resulted in failing test for legacy PHP | ||
| ini_set('xdebug.max_nesting_level', 256); | ||
|
|
||
| $promise = $this->resolver->resolve('google.com'); | ||
| $promise = $this->resolver->resolve('bing.com'); | ||
| $promise->cancel(); | ||
|
|
||
| $time = microtime(true); | ||
|
|
@@ -142,15 +144,15 @@ public function testResolveCancelledRejectsImmediately() | |
|
|
||
| /** @var \React\Dns\Query\CancellationException $exception */ | ||
| $this->assertInstanceOf('React\Dns\Query\CancellationException', $exception); | ||
| $this->assertEquals('DNS query for google.com (A) has been cancelled', $exception->getMessage()); | ||
| $this->assertEquals('DNS query for bing.com (A) has been cancelled', $exception->getMessage()); | ||
| } | ||
|
|
||
| /** | ||
| * @group internet | ||
| */ | ||
| public function testResolveAllInvalidTypeRejects() | ||
| { | ||
| $promise = $this->resolver->resolveAll('google.com', Message::TYPE_PTR); | ||
| $promise = $this->resolver->resolveAll('bing.com', Message::TYPE_PTR); | ||
|
|
||
| Loop::run(); | ||
|
|
||
|
|
@@ -161,17 +163,18 @@ public function testResolveAllInvalidTypeRejects() | |
|
|
||
| /** @var \React\Dns\RecordNotFoundException $exception */ | ||
| $this->assertInstanceOf('React\Dns\RecordNotFoundException', $exception); | ||
| $this->assertEquals('DNS query for google.com (PTR) did not return a valid answer (NOERROR / NODATA)', $exception->getMessage()); | ||
| $this->assertEquals('DNS query for bing.com (PTR) did not return a valid answer (NOERROR / NODATA)', $exception->getMessage()); | ||
| $this->assertEquals(0, $exception->getCode()); | ||
| } | ||
|
|
||
| public function testInvalidResolverDoesNotResolveGoogle() | ||
| public function testInvalidResolverDoesNotResolvebing() | ||
| { | ||
| $factory = new Factory(); | ||
| $this->resolver = $factory->create('255.255.255.255'); | ||
|
|
||
| $promise = $this->resolver->resolve('google.com'); | ||
| $promise = $this->resolver->resolve('bing.com'); | ||
| $promise->then($this->expectCallableNever(), $this->expectCallableOnce()); | ||
| Loop::run(); | ||
| } | ||
|
|
||
| public function testResolveShouldNotCauseGarbageReferencesWhenUsingInvalidNameserver() | ||
|
|
@@ -186,7 +189,7 @@ public function testResolveShouldNotCauseGarbageReferencesWhenUsingInvalidNamese | |
| gc_collect_cycles(); | ||
| gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on | ||
|
|
||
| $promise = $this->resolver->resolve('google.com'); | ||
| $promise = $this->resolver->resolve('bing.com'); | ||
| unset($promise); | ||
|
|
||
| $this->assertEquals(0, gc_collect_cycles()); | ||
|
|
@@ -204,7 +207,7 @@ public function testResolveCachedShouldNotCauseGarbageReferencesWhenUsingInvalid | |
| gc_collect_cycles(); | ||
| gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on | ||
|
|
||
| $promise = $this->resolver->resolve('google.com'); | ||
| $promise = $this->resolver->resolve('bing.com'); | ||
| unset($promise); | ||
|
|
||
| $this->assertEquals(0, gc_collect_cycles()); | ||
|
|
@@ -222,7 +225,7 @@ public function testCancelResolveShouldNotCauseGarbageReferences() | |
| gc_collect_cycles(); | ||
| gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on | ||
|
|
||
| $promise = $this->resolver->resolve('google.com'); | ||
| $promise = $this->resolver->resolve('bing.com'); | ||
| $promise->cancel(); | ||
| $promise = null; | ||
|
|
||
|
|
@@ -241,7 +244,7 @@ public function testCancelResolveCachedShouldNotCauseGarbageReferences() | |
| gc_collect_cycles(); | ||
| gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on | ||
|
|
||
| $promise = $this->resolver->resolve('google.com'); | ||
| $promise = $this->resolver->resolve('bing.com'); | ||
| $promise->cancel(); | ||
| $promise = null; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -538,7 +538,7 @@ public function testQueryRejectsWhenServerSendsInvalidMessage() | |
| $address = stream_socket_get_name($server, false); | ||
| $executor = new TcpTransportExecutor($address); | ||
|
|
||
| $query = new Query('google.com', Message::TYPE_A, Message::CLASS_IN); | ||
| $query = new Query('bing.com', Message::TYPE_A, Message::CLASS_IN); | ||
|
|
||
| $exception = null; | ||
| $executor->query($query)->then( | ||
|
|
@@ -555,7 +555,7 @@ function ($e) use (&$exception) { | |
|
|
||
| /** @var \RuntimeException $exception */ | ||
| $this->assertInstanceOf('RuntimeException', $exception); | ||
| $this->assertEquals('DNS query for google.com (A) failed: Invalid message received from DNS server tcp://' . $address, $exception->getMessage()); | ||
| $this->assertEquals('DNS query for bing.com (A) failed: Invalid message received from DNS server tcp://' . $address, $exception->getMessage()); | ||
| } | ||
|
|
||
| public function testQueryRejectsWhenServerSendsInvalidId() | ||
|
|
@@ -691,7 +691,7 @@ public function testQueryResolvesIfServerSendsValidResponse() | |
|
|
||
| $this->assertInstanceOf('React\Dns\Model\Message', $response); | ||
| } | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is a leftover. |
||
| public function testQueryRejectsIfSocketIsClosedAfterPreviousQueryThatWasStillPending() | ||
| { | ||
| $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.