4 * @covers DnsSrvDiscoverer
6 class DnsSrvDiscovererTest
extends PHPUnit_Framework_TestCase
{
8 * @dataProvider provideRecords
10 public function testPickServer( $params, $expected ) {
11 $discoverer = new DnsSrvDiscoverer( 'etcd-tcp.example.net' );
12 $record = $discoverer->pickServer( $params );
14 $this->assertEquals( $expected, $record );
17 public static function provideRecords() {
22 'target' => 'conf03.example.net',
28 'target' => 'conf02.example.net',
34 'target' => 'conf01.example.net',
41 'target' => 'conf03.example.net',
50 'target' => 'conf03or2.example.net',
56 'target' => 'conf03or2.example.net',
62 'target' => 'conf01.example.net',
68 'target' => 'conf04.example.net',
74 'target' => 'conf05.example.net',
81 'target' => 'conf03or2.example.net',
90 public function testRemoveServer() {
91 $dsd = new DnsSrvDiscoverer( 'localhost' );
95 'target' => 'conf01.example.net',
101 'target' => 'conf04.example.net',
107 'target' => 'conf05.example.net',
113 $server = $servers[1];
117 'target' => 'conf01.example.net',
123 'target' => 'conf05.example.net',
132 $dsd->removeServer( $server, $servers ),
133 "Correct server removed"
137 $dsd->removeServer( $server, $servers ),