Merge pull request #20354 from stanley-cheung/php-update-memleak-test

PHP: update memory leak tests
pull/20363/head
Stanley Cheung 5 years ago committed by GitHub
commit 9e426b02ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      src/php/tests/MemoryLeakTest/MemoryLeakTest.php

@ -47,7 +47,7 @@ function waitUntilNotIdle($channel) {
} }
// Set up // Set up
$channel = new Grpc\Channel('localhost:0', ['credentials' => Grpc\ChannelCredentials::createInsecure()]); $channel = new Grpc\Channel('localhost:50101', ['credentials' => Grpc\ChannelCredentials::createInsecure()]);
// Test InsecureCredentials // Test InsecureCredentials
assert('Grpc\Channel' == get_class($channel)); assert('Grpc\Channel' == get_class($channel));
@ -56,28 +56,16 @@ assert('Grpc\Channel' == get_class($channel));
$state = $channel->getConnectivityState(); $state = $channel->getConnectivityState();
assert(0 == $state); assert(0 == $state);
// Test GetConnectivityStateWithInt
$state = $channel->getConnectivityState(123);
assert(0 == $state);
// Test GetConnectivityStateWithString
$state = $channel->getConnectivityState('hello');
assert(0 == $state);
// Test GetConnectivityStateWithBool
$state = $channel->getConnectivityState(true);
assert(0 == $state);
$channel->close(); $channel->close();
// Test GetTarget // Test GetTarget
$channel = new Grpc\Channel('localhost:8888', ['credentials' => Grpc\ChannelCredentials::createInsecure()]); $channel = new Grpc\Channel('localhost:50102', ['credentials' => Grpc\ChannelCredentials::createInsecure()]);
$target = $channel->getTarget(); $target = $channel->getTarget();
assert(is_string($target) == true); assert(is_string($target) == true);
$channel->close(); $channel->close();
// Test WatchConnectivityState // Test WatchConnectivityState
$channel = new Grpc\Channel('localhost:0', ['credentials' => Grpc\ChannelCredentials::createInsecure()]); $channel = new Grpc\Channel('localhost:50103', ['credentials' => Grpc\ChannelCredentials::createInsecure()]);
$now = Grpc\Timeval::now(); $now = Grpc\Timeval::now();
$deadline = $now->add(new Grpc\Timeval(100*1000)); $deadline = $now->add(new Grpc\Timeval(100*1000));

Loading…
Cancel
Save