@@ -46,7 +46,6 @@ public function testCreateMetric()
46
46
$ this ->assertContains (self ::$ metricId , $ output );
47
47
48
48
// ensure the metric gets created
49
- $ this ->eventuallyConsistentRetryCount = 20 ;
50
49
$ this ->runEventuallyConsistentTest (function () {
51
50
$ output = $ this ->runCommand ('get-descriptor ' , [
52
51
'metric_id ' => self ::$ metricId ,
@@ -64,14 +63,14 @@ public function testGetDescriptor()
64
63
$ this ->assertContains (self ::$ metricId , $ output );
65
64
}
66
65
67
- /** @depends testCreateMetric */
66
+ /** @depends testGetDescriptor */
68
67
public function testListDescriptors ()
69
68
{
70
69
$ output = $ this ->runCommand ('list-descriptors ' );
71
70
$ this ->assertContains (self ::$ metricId , $ output );
72
71
}
73
72
74
- /** @depends testCreateMetric */
73
+ /** @depends testListDescriptors */
75
74
public function testDeleteMetric ()
76
75
{
77
76
$ output = $ this ->runCommand ('delete-metric ' , [
@@ -132,10 +131,15 @@ private function runCommand($commandName, $args = [])
132
131
$ commandTester = new CommandTester ($ command );
133
132
134
133
ob_start ();
135
- $ commandTester ->execute (
136
- ['project_id ' => self ::$ projectId ] + $ args ,
137
- ['interactive ' => false ]);
138
-
134
+ try {
135
+ $ commandTester ->execute (
136
+ ['project_id ' => self ::$ projectId ] + $ args ,
137
+ ['interactive ' => false ]);
138
+ } catch (\Google \GAX \Exception $ e ) {
139
+ // if the command throws an error cast it as a string (as this would be the output)
140
+ $ application ->renderException ($ e , $ commandTester ->getOutput ());
141
+ return $ commandTester ->getDisplay ();
142
+ }
139
143
return ob_get_clean ();
140
144
}
141
145
}
0 commit comments