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 );
15 public static function provideRecords() {
20 'target' => 'conf03.example.net',
26 'target' => 'conf02.example.net',
32 'target' => 'conf01.example.net',
39 'target' => 'conf03.example.net',
48 'target' => 'conf03or2.example.net',
54 'target' => 'conf03or2.example.net',
60 'target' => 'conf01.example.net',
66 'target' => 'conf04.example.net',
72 'target' => 'conf05.example.net',
79 'target' => 'conf03or2.example.net',
88 public function testRemoveServer() {
89 $dsd = new DnsSrvDiscoverer( 'localhost' );
93 'target' => 'conf01.example.net',
99 'target' => 'conf04.example.net',
105 'target' => 'conf05.example.net',
111 $server = $servers[1];
115 'target' => 'conf01.example.net',
121 'target' => 'conf05.example.net',
130 $dsd->removeServer( $server, $servers ),
131 "Correct server removed"
135 $dsd->removeServer( $server, $servers ),