3 class DnsSrvDiscovererTest
extends PHPUnit_Framework_TestCase
{
5 * @covers DnsSrvDiscoverer
6 * @dataProvider provideRecords
8 public function testPickServer( $params, $expected ) {
9 $discoverer = new DnsSrvDiscoverer( 'etcd-tcp.example.net' );
10 $record = $discoverer->pickServer( $params );
12 $this->assertEquals( $expected, $record );
16 public static function provideRecords() {
21 'target' => 'conf03.example.net',
27 'target' => 'conf02.example.net',
33 'target' => 'conf01.example.net',
40 'target' => 'conf03.example.net',
49 'target' => 'conf03or2.example.net',
55 'target' => 'conf03or2.example.net',
61 'target' => 'conf01.example.net',
67 'target' => 'conf04.example.net',
73 'target' => 'conf05.example.net',
80 'target' => 'conf03or2.example.net',
89 public function testRemoveServer() {
90 $dsd = new DnsSrvDiscoverer( 'localhost' );
94 'target' => 'conf01.example.net',
100 'target' => 'conf04.example.net',
106 'target' => 'conf05.example.net',
112 $server = $servers[1];
116 'target' => 'conf01.example.net',
122 'target' => 'conf05.example.net',
131 $dsd->removeServer( $server, $servers ),
132 "Correct server removed"
136 $dsd->removeServer( $server, $servers ),