@@ -45,6 +45,11 @@ public static function getProjectId()
45
45
return getenv ('GOOGLE_PROJECT_ID ' );
46
46
}
47
47
48
+ public static function getServiceName ()
49
+ {
50
+ return getenv ('GOOGLE_SERVICE_NAME ' );
51
+ }
52
+
48
53
private static function getTargetDir ()
49
54
{
50
55
$ tmp = sys_get_temp_dir ();
@@ -169,7 +174,7 @@ private static function downloadAndInstallDrupal($targetDir, $console)
169
174
}
170
175
171
176
// if a service name has been defined, add it to "app.yaml"
172
- if ($ service = getenv ( ' GOOGLE_SERVICE_NAME ' )) {
177
+ if ($ service = self :: getServiceName ( )) {
173
178
$ appYaml = sprintf ('%s/drupal8.test/app.yaml ' , $ targetDir );
174
179
file_put_contents ($ appYaml , "service: $ service \n" , FILE_APPEND );
175
180
}
@@ -196,11 +201,12 @@ public static function deploy($projectId, $versionId, $targetDir)
196
201
public static function tearDownAfterClass ()
197
202
{
198
203
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
+ ));
204
210
$ process ->setTimeout (600 ); // 10 minutes
205
211
if (self ::executeProcess ($ process , false )) {
206
212
return ;
@@ -211,9 +217,11 @@ public static function tearDownAfterClass()
211
217
212
218
public function setUp ()
213
219
{
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 ());
217
225
$ this ->client = new Client (['base_uri ' => $ url ]);
218
226
}
219
227
0 commit comments