[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pecl-cvs
Subject:    [PECL-CVS] =?utf-8?q?svn:_/pecl/mysqlnd=5Fms/trunk/tests/_mysqlnd=5Fms=5Ffilter=5Fro=5Fpartitioning=
From:       Ulf_Wendel <uw () php ! net>
Date:       2011-07-28 14:35:18
Message-ID: svn-uw-1311863718-313870-752858540 () svn ! php ! net
[Download RAW message or body]

uw                                       Thu, 28 Jul 2011 14:35:18 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=313870

Log:
Warn about misconfiguration or not? Same about the previous tests... letting it pass \
like the previous once. Though, could give us bug reports from users for 1.1

Changed paths:
    A   pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_filter_ro_partitioning_rr.phpt

Added: pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_filter_ro_partitioning_rr.phpt
===================================================================
--- pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_filter_ro_partitioning_rr.phpt	            \
                (rev 0)
+++ pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_filter_ro_partitioning_rr.phpt	2011-07-28 \
14:35:18 UTC (rev 313870) @@ -0,0 +1,89 @@
+--TEST--
+Stacking LB filters and partitioning filter
+--SKIPIF--
+<?php
+require_once('skipif_mysqli.inc');
+require_once("connect.inc");
+
+$settings = array(
+	"myapp" => array(
+		'master' => array(
+			"master1" => array(
+				'host' 		=> $master_host_only,
+				'port' 		=> (int)$master_port,
+				'socket' 	=> $master_socket,
+			),
+		),
+		'slave' => array(
+			"slave1" => array(
+				'host' 	=> $slave_host_only,
+				'port' 	=> (int)$slave_port,
+				'socket' => $slave_socket,
+			),
+			"slave2" => array(
+				'host' 	=> $slave_host_only,
+				'port' 	=> (int)$slave_port,
+				'socket' => $slave_socket,
+			),
+		 ),
+		'lazy_connections' => 0,
+		'filters' => array(
+			"random" => array("sticky" => 1),
+			"table" => array(
+				"rules" => array(
+					"%" => array(
+					  "master" => array("master1"),
+					  "slave" => array("slave1", "slave2"),
+					),
+				),
+			),
+			"roundrobin" => array(),
+		),
+	),
+
+);
+if ($error = create_config("test_mysqlnd_ms_filter_ro_partitioning_rr.ini", \
$settings)) +	die(sprintf("SKIP %s\n", $error));
+?>
+--INI--
+mysqlnd_ms.enable=1
+mysqlnd_ms.ini_file=test_mysqlnd_ms_filter_ro_partitioning_rr.ini
+--FILE--
+<?php
+	require_once("connect.inc");
+	require_once("mysqlnd_ms_lazy.inc");
+
+	$link = my_mysqli_connect("myapp", $user, $passwd, $db, $port, $socket);
+	if (mysqli_connect_errno()) {
+		printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+	}
+
+	$threads = array();
+	run_query(2, $link, "SET @myrole='master'");
+	$threads[$link->thread_id] = 'master';
+	run_query(3, $link, "SET @myrole='slave1'", MYSQLND_MS_SLAVE_SWITCH);
+	$threads[$link->thread_id] = 'slave1';
+	run_query(4, $link, "SET @myrole='slave2'", MYSQLND_MS_SLAVE_SWITCH);
+	$threads[$link->thread_id] = 'slave2';
+
+	$res = run_query(5, $link, "SELECT @myrole AS _role");
+	$row = $res->fetch_assoc();
+	printf("[006] Hi folks, %s speaking.\n", $row['_role']);
+
+
+	foreach ($threads as $id => $role)
+		printf("%d => %s\n", $id, $role);
+
+	print "done!";
+?>
+--CLEAN--
+<?php
+	if (!unlink("test_mysqlnd_ms_filter_ro_partitioning_rr.ini"))
+	  printf("[clean] Cannot unlink ini file \
'test_mysqlnd_ms_filter_ro_partitioning_rr.ini'.\n"); +?>
+--EXPECTF--
+Warn about misconfiguration or not?
+[006] Hi folks, slave%d speaking.
+%d => master
+%d => slave%d
+done!
\ No newline at end of file



-- 
PECL CVS Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic