コード例 #1
0
ファイル: twodefaulttest.php プロジェクト: cgvarela/scribe
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
// See accompanying file LICENSE or visit the Scribe site at:
// http://developers.facebook.com/scribe/
// very similar to basictestst. Infact it does every test that basictest does
// but does them twice - once for each place where default category gets logged.
// The scribe.conf.twodefaulttest will show that the default category is being
// logged into two filestores simultaneously
require_once 'tests.php';
require_once 'testutil.php';
$success = true;
$pid = scribe_start('twodefaulttest', $GLOBALS['SCRIBE_BIN'], $GLOBALS['SCRIBE_PORT'], 'scribe.conf.twodefaulttest');
// write 10k messages to category test (handled by default store)
print "test writing 10k messages to category test\n";
stress_test('test', 'client1', 1000, 10000, 20, 100, 1);
sleep(1);
$results = resultChecker('/tmp/scribetest_/test', 'test-', 'client1');
if ($results["count"] != 10000 || $results["out_of_order"] != 0) {
    $success = false;
    print_r($results);
}
$results = resultChecker('/tmp/scribe_test_/test', 'test-', 'client1');
if ($results["count"] != 10000 || $results["out_of_order"] != 0) {
    $success = false;
    print_r($results);
}
// write another 10k messages to category test (should see 1 out of order)
コード例 #2
0
ファイル: basictest2.php プロジェクト: lmtwga/scribe
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
// See accompanying file LICENSE or visit the Scribe site at:
// http://developers.facebook.com/scribe/
include_once 'tests.php';
include_once 'testutil.php';
// basictest2 is similar to simpletest, except it turns off
// new_thread_per_category and sets num_thrift_server_threads
$success = true;
$pid = scribe_start('basictest2', $GLOBALS['SCRIBE_BIN'], $GLOBALS['SCRIBE_PORT'], 'scribe.conf.basictest2');
// write 10k messages to category test (handled by default store)
print "test writing 10k messages to category test\n";
stress_test('test', 'client1', 1000, 10000, 20, 100, 1);
sleep(5);
$results = resultChecker('/tmp/scribetest_/default', 'default-', 'client1');
if ($results["count"] != 10000 || $results["out_of_order"] != 0) {
    $success = false;
}
// write another 10k messages to category test (should see 1 out of order)
print "test writing another 10k messages (will see 1 out of order)\n";
stress_test('test', 'client1', 1000, 10000, 20, 100, 1);
sleep(5);
$results = resultChecker('/tmp/scribetest_/default', 'default-', 'client1');
if ($results["count"] != 20000 || $results["out_of_order"] != 1) {
    $success = false;
コード例 #3
0
ファイル: paramtest.php プロジェクト: cgvarela/scribe
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
// See accompanying file LICENSE or visit the Scribe site at:
// http://developers.facebook.com/scribe/
require_once 'tests.php';
require_once 'testutil.php';
// param test.  send messages to category paramtest
// and verify that message is found in the file
$success = true;
$pid = scribe_start('paramtest', $GLOBALS['SCRIBE_BIN'], $GLOBALS['SCRIBE_PORT'], 'scribe.conf.paramtest');
print "running param inheritance test\n";
param_test();
sleep(2);
// check results
$file = "/tmp/scribetest_/paramtest/primary_current";
$cmd = "grep \"paramtest\" {$file} > /dev/null 2>&1; echo \$?";
echo "checking message: {$cmd}\n";
system($cmd, $ret);
if ($ret != 0) {
    print "ERROR: didn't find message\"paramtest\" in file {$file}\n";
    $success = false;
}
if (!scribe_stop($GLOBALS['SCRIBE_CTRL'], $GLOBALS['SCRIBE_PORT'], $pid)) {
    print "ERROR: could not stop scribe\n";
    return false;
コード例 #4
0
ファイル: simpletest.php プロジェクト: cgvarela/scribe
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
// See accompanying file LICENSE or visit the Scribe site at:
// http://developers.facebook.com/scribe/
include_once 'tests.php';
include_once 'testutil.php';
// run some simpletests
// -verify that we can send a message
// -send a message with non-printable characters
// -send some strange input messages
$success = true;
$pid = scribe_start('simpletest', $GLOBALS['SCRIBE_BIN'], $GLOBALS['SCRIBE_PORT'], 'scribe.conf.simpletest');
print "running strange input test\n";
strange_input_test();
sleep(2);
print "running some simple tests\n";
simple_test();
// wait for messages to arrive
sleep(5);
// check results
$file = fopen("/tmp/scribetest_/scribe_test/scribe_test_current", 'r');
if ($file) {
    // strange_input_test should end up writing '\n'
    $line = fgets($file, 3);
    if ($line != '\\n') {
        print "ERROR: Did not find first message\n";
        $success = false;
コード例 #5
0
ファイル: categoriestest.php プロジェクト: cgvarela/scribe
//  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
// See accompanying file LICENSE or visit the Scribe site at:
// http://developers.facebook.com/scribe/
include_once 'tests.php';
include_once 'testutil.php';
$success = true;
$pid = scribe_start('categoriestest', $GLOBALS['SCRIBE_BIN'], $GLOBALS['SCRIBE_PORT'], 'scribe.conf.categoriestest');
// write 10k messages to many different categories
$categories = array("hello", "foo", "food", "rock", "rockstar", "paper", "scissors", "apple", "banana");
$client = "client1";
print "Testing writing 100k messages to multiple categories.\n";
super_stress_test($categories, $client, 1000, 100000, 20, 100, 1);
sleep(10);
// verify all messages got written
foreach ($categories as $category) {
    $path = "/tmp/scribetest_/{$category}";
    $prefix = $category . '-';
    print "Verifying messages for category {$category}.\n";
    $results = resultChecker($path, $prefix, $client);
    if ($results["count"] != 100000 || $results["out_of_order"] != 0) {
        print "Error:Bad results for category {$category}\n";
        $success = false;
コード例 #6
0
ファイル: buffertest.php プロジェクト: manvinderr21/scribe
//  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
// See accompanying file LICENSE or visit the Scribe site at:
// http://developers.facebook.com/scribe/
include_once 'tests.php';
include_once 'testutil.php';
$success = true;
$pid = scribe_start('buffertest', $GLOBALS['SCRIBE_BIN'], $GLOBALS['SCRIBE_PORT'], 'scribe.conf.buffertest');
// delete scribetest_ directory, and try to log messages there.
// Then recreate directory and verify that buffers get written
system("rm -rf /tmp/scribetest_", $error);
if ($error) {
    print "ERROR: unable to delete /tmp/scribetest_\n";
}
// write 10k messages to category test (handled by default store)
print "test writing 10k messages to category test\n";
stress_test('test', 'client1', 1000, 10000, 20, 100, 1);
// write another 10k messages to category test (should see 1 out of order)
sleep(2);
print "test writing another 10k messages (will see 1 out of order)\n";
stress_test('test', 'client1', 1000, 10000, 20, 100, 1);
// write 200k messages to category test using different client name
print "test writing 200k more messages to category test\n";
コード例 #7
0
ファイル: bucketupdater.php プロジェクト: manvinderr21/scribe
// start scribe server2
$pidScribe2 = scribe_start("bucketupdater.server2", $GLOBALS['SCRIBE_BIN'], 1466, "scribe.conf.bucketupdater.server2");
echo "Starting scribe server2: 1467, scribe.conf.bucketupdater.server2\n";
// start scribe server3
$pidScribe3 = scribe_start("bucketupdater.server3", $GLOBALS['SCRIBE_BIN'], 1467, "scribe.conf.bucketupdater.server3");
$cmd = "ln -sf bidmap.1 bidmap";
echo "{$cmd}\n";
// symlink
system($cmd);
// start bidupdaer
$cmd = "../../_bin/scribe/test/bucketupdater/bidupdater -p 9999 -f ./bidmap > bidupdater.out 2>&1 & echo \$!";
echo "{$cmd}\n";
$pidUpdater = system($cmd);
echo "Starting scribe central server: 1463,scribe.conf.bucketupdater.central.\n";
// start scribe central server
$pidScribeCentral = scribe_start("bucketupdater.central", $GLOBALS['SCRIBE_BIN'], 1463, "scribe.conf.bucketupdater.central");
// test
$success1 = bucketupdater_test("server1/bucket001/content_current", "server2/bucket002/content_current", "server3/bucket002/content_current");
// change symlink
$cmd = "ln -sf bidmap.2 bidmap";
echo "{$cmd}\n";
system($cmd);
echo "sleep(15) to wait for bucket updater to take effect.\n";
sleep(15);
// test again
$success2 = bucketupdater_test("server2/bucket001/content_current", "server1/bucket002/content_current", "server1/bucket002/content_current");
// stop scribe server
scribe_stop($GLOBALS['SCRIBE_CTRL'], 1465, $pidScribe1);
scribe_stop($GLOBALS['SCRIBE_CTRL'], 1466, $pidScribe2);
scribe_stop($GLOBALS['SCRIBE_CTRL'], 1467, $pidScribe3);
scribe_stop($GLOBALS['SCRIBE_CTRL'], 1463, $pidScribeCentral);