Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tests): [PubSub] run rest tests against the emulator #8056

Merged
merged 3 commits into from
Feb 2, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore(tests): [PubSub] run rest tests against the emulator
bshaffer committed Jan 29, 2025
commit 4f2ebda02bbff3c72906f42c29b45b28f8622518
2 changes: 1 addition & 1 deletion .github/workflows/system-tests-pubsub-emulator.yaml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- run: ./.github/emulator/start-emulator.sh pubsub 413.0.0-emulators
- run: ./.github/emulator/start-emulator.sh pubsub

- name: Setup PHP
uses: shivammathur/setup-php@v2
27 changes: 13 additions & 14 deletions PubSub/tests/System/PubSubTestCase.php
Original file line number Diff line number Diff line change
@@ -34,13 +34,14 @@ public function clientProvider()
{
self::setUpTestFixtures();

$result = [
if (is_null(self::$grpcClient)) {
return ['rest' => [self::$restClient]];
}

return [
'grpc' => [self::$grpcClient],
'rest' => [self::$restClient],
];
if (!self::isEmulatorUsed()) {
$result['rest'] = [self::$restClient];
}
return $result;
}

/**
@@ -53,14 +54,16 @@ public static function setUpTestFixtures(): void
}

$keyFilePath = getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH');
self::$restClient = new PubSubClientRest([
self::$restClient = new PubSubClient([
'credentials' => $keyFilePath,
'transport' => 'rest',
]);
self::$grpcClient = new PubSubClientGrpc([
'credentials' => $keyFilePath,
'transport' => 'grpc',
]);
if (extension_loaded('grpc')) {
self::$grpcClient = new PubSubClient([
'credentials' => $keyFilePath,
'transport' => 'grpc',
]);
}
self::setUsingEmulatorForClassPrefix((bool) getenv('PUBSUB_EMULATOR_HOST'));
self::setupQueue();
self::$hasSetUp = true;
@@ -105,7 +108,3 @@ public static function topicAndSubscription(PubSubClient $client, array $topicCo
}
}

//@codingStandardsIgnoreStart
class PubSubClientRest extends PubSubClient {}
class PubSubClientGrpc extends PubSubClient {}
//@codingStandardsIgnoreEnd