Skip to content

Commit ddf174f

Browse files
committed
finish adding service support for drupal8 tests
1 parent bc5a709 commit ddf174f

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

appengine/flexible/drupal8/tests/DeployTest.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ public static function getProjectId()
4545
return getenv('GOOGLE_PROJECT_ID');
4646
}
4747

48+
public static function getServiceName()
49+
{
50+
return getenv('GOOGLE_SERVICE_NAME');
51+
}
52+
4853
private static function getTargetDir()
4954
{
5055
$tmp = sys_get_temp_dir();
@@ -169,7 +174,7 @@ private static function downloadAndInstallDrupal($targetDir, $console)
169174
}
170175

171176
// if a service name has been defined, add it to "app.yaml"
172-
if ($service = getenv('GOOGLE_SERVICE_NAME')) {
177+
if ($service = self::getServiceName()) {
173178
$appYaml = sprintf('%s/drupal8.test/app.yaml', $targetDir);
174179
file_put_contents($appYaml, "service: $service\n", FILE_APPEND);
175180
}
@@ -196,11 +201,12 @@ public static function deploy($projectId, $versionId, $targetDir)
196201
public static function tearDownAfterClass()
197202
{
198203
for ($i = 0; $i <= 3; $i++) {
199-
$process = self::createProcess(
200-
'gcloud -q preview app versions delete --service default '
201-
. self::getVersion()
202-
. ' --project ' . self::getProjectId()
203-
);
204+
$process = self::createProcess(sprintf(
205+
'gcloud -q preview app versions delete %s --service %s --project %s',
206+
self::getVersion(),
207+
self::getServiceName() ?: 'default',
208+
self::getProjectId()
209+
));
204210
$process->setTimeout(600); // 10 minutes
205211
if (self::executeProcess($process, false)) {
206212
return;
@@ -211,9 +217,11 @@ public static function tearDownAfterClass()
211217

212218
public function setUp()
213219
{
214-
$url = sprintf('https://%s-dot-%s.appspot.com/',
215-
self::getVersion(),
216-
self::getProjectId());
220+
$service = self::getServiceName();
221+
$url = sprintf('https://%s%s-dot-%s.appspot.com/',
222+
self::getVersion(),
223+
$service ? "-dot-$service" : '',
224+
self::getProjectId());
217225
$this->client = new Client(['base_uri' => $url]);
218226
}
219227

0 commit comments

Comments
 (0)