Skip to content

Commit a66918a

Browse files
committed
AC-15461: Migration New Relic from REST v2 to NerdGraph (GraphQL)
1 parent 413e982 commit a66918a

File tree

3 files changed

+8
-206
lines changed

3 files changed

+8
-206
lines changed

dev/tests/integration/testsuite/Magento/NewRelicReporting/Console/Command/DeployMarkerCommandTest.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
/**
2222
* Integration test for DeployMarker console command.
2323
* Covers framework integration (DI, Config, CLI) for both v2_rest and NerdGraph modes.
24-
* API calls are not executed against real endpoints (fake credentials only).
2524
*
2625
* @magentoAppIsolation enabled
2726
*/
@@ -51,8 +50,6 @@ protected function setUp(): void
5150
{
5251
$this->objectManager = Bootstrap::getObjectManager();
5352
$this->mutableScopeConfig = $this->objectManager->get(MutableScopeConfigInterface::class);
54-
55-
// Focus: Test Magento framework integration (DI, Config, CLI)
5653
$this->command = $this->objectManager->get(DeployMarker::class);
5754
$this->commandTester = new CommandTester($this->command);
5855
}
@@ -107,15 +104,13 @@ public function testCommandWithMinimalArgumentsV2Rest()
107104
'message' => 'Test deployment message'
108105
]);
109106

110-
// Framework integration: Should handle gracefully (success or graceful failure)
111107
$this->assertTrue(in_array($exitCode, [0, 1], true), 'Command should exit with 0 (success) or 1 (graceful failure)');
112108
$output = $this->commandTester->getDisplay();
113109

114-
// Test: No fatal framework errors
110+
// No fatal framework errors
115111
$this->assertStringNotContainsString('Fatal error', $output);
116112
$this->assertStringNotContainsString('Call to a member function', $output);
117113

118-
// Test: Command produces meaningful UX message
119114
$this->assertMatchesRegularExpression('/(✓|✗)/', $output, 'Output should contain success (✓) or error (✗) indicator');
120115
}
121116

@@ -159,7 +154,6 @@ public function testCommandConfiguration()
159154
*/
160155
public function testCommandWithAllParametersNerdGraph()
161156
{
162-
// Test: Magento config system integration
163157
$this->mutableScopeConfig->setValue('newrelicreporting/general/enable', '1');
164158
$this->mutableScopeConfig->setValue('newrelicreporting/general/api_mode', 'nerdgraph');
165159
$this->mutableScopeConfig->setValue('newrelicreporting/general/entity_guid', 'fake-guid-for-testing');
@@ -179,11 +173,8 @@ public function testCommandWithAllParametersNerdGraph()
179173
$this->assertTrue(in_array($exitCode, [0, 1], true), 'Command should exit with 0 (success) or 1 (graceful failure)');
180174
$output = $this->commandTester->getDisplay();
181175

182-
// Test: No fatal framework errors
183176
$this->assertStringNotContainsString('Fatal error', $output);
184177
$this->assertStringNotContainsString('Call to a member function', $output);
185-
186-
// Test: Command produces meaningful UX message
187178
$this->assertMatchesRegularExpression('/(✓|✗)/', $output, 'Output should contain success (✓) or error (✗) indicator');
188179
}
189180

@@ -198,12 +189,10 @@ public function testCommandWithEmptyMessage()
198189
'message' => ''
199190
]);
200191

201-
// Should process empty message (validation handled by deployment service)
202192
$this->assertIsInt($exitCode);
203193
$output = $this->commandTester->getDisplay();
204194
$this->assertStringNotContainsString('Fatal error', $output);
205195

206-
// Test: Command produces meaningful UX message even for empty input
207196
$this->assertMatchesRegularExpression('/(✓|✗)/', $output, 'Output should contain success (✓) or error (✗) indicator');
208197
}
209198

dev/tests/integration/testsuite/Magento/NewRelicReporting/Console/Command/EuEndpointTest.php

Lines changed: 0 additions & 164 deletions
This file was deleted.

dev/tests/integration/testsuite/Magento/NewRelicReporting/Model/NerdGraph/DeploymentWorkflowTest.php

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Framework\App\Config\MutableScopeConfigInterface;
1111
use Magento\Framework\App\Config\ScopeConfigInterface;
1212
use Magento\Framework\Exception\LocalizedException;
13+
use Magento\Framework\HTTP\LaminasClient;
1314
use Magento\Framework\HTTP\LaminasClientFactory;
1415
use Magento\Framework\ObjectManagerInterface;
1516
use Magento\Framework\Serialize\SerializerInterface;
@@ -170,13 +171,13 @@ public function testNerdGraphModeSelection()
170171

171172
/**
172173
* Test Deployments service configuration
174+
* @throws \ReflectionException
173175
*/
174176
public function testDeploymentsServiceConfiguration()
175177
{
176178
// Test that Deployments service is properly configured
177179
$this->assertInstanceOf(Deployments::class, $this->deployments);
178180

179-
// Test dependency injection
180181
$reflection = new \ReflectionClass($this->deployments);
181182
$constructor = $reflection->getConstructor();
182183
$parameters = $constructor->getParameters();
@@ -199,12 +200,12 @@ public function testDeploymentsServiceConfiguration()
199200

200201
/**
201202
* Test NerdGraph Client configuration
203+
* @throws \ReflectionException
202204
*/
203205
public function testNerdGraphClientConfiguration()
204206
{
205207
$this->assertInstanceOf(Client::class, $this->nerdGraphClient);
206208

207-
// Test dependency injection
208209
$reflection = new \ReflectionClass($this->nerdGraphClient);
209210
$constructor = $reflection->getConstructor();
210211
$parameters = $constructor->getParameters();
@@ -225,12 +226,12 @@ public function testNerdGraphClientConfiguration()
225226

226227
/**
227228
* Test DeploymentTracker configuration
229+
* @throws \ReflectionException
228230
*/
229231
public function testDeploymentTrackerConfiguration()
230232
{
231233
$this->assertInstanceOf(DeploymentTracker::class, $this->deploymentTracker);
232234

233-
// Test dependency injection
234235
$reflection = new \ReflectionClass($this->deploymentTracker);
235236
$constructor = $reflection->getConstructor();
236237
$parameters = $constructor->getParameters();
@@ -289,7 +290,7 @@ public function testHttpClientFactoryIntegration()
289290

290291
// Should be able to create HTTP client
291292
$httpClient = $httpClientFactory->create();
292-
$this->assertInstanceOf(\Magento\Framework\HTTP\LaminasClient::class, $httpClient);
293+
$this->assertInstanceOf(LaminasClient::class, $httpClient);
293294
}
294295

295296
/**
@@ -318,36 +319,12 @@ public function testLoggerIntegration()
318319

319320
// Should be able to log without errors
320321
$logger->info('Test log message from integration test');
321-
$this->assertTrue(true); // If we get here, logging worked
322-
}
323-
324-
/**
325-
* Test configuration paths are accessible
326-
*/
327-
public function testConfigurationPaths()
328-
{
329-
$testPaths = [
330-
'newrelicreporting/general/enable',
331-
'newrelicreporting/general/api_mode',
332-
'newrelicreporting/general/entity_guid',
333-
'newrelicreporting/general/app_id',
334-
'newrelicreporting/general/app_name',
335-
'newrelicreporting/general/api',
336-
'newrelicreporting/general/nerd_graph_api_url',
337-
'newrelicreporting/general/api_url'
338-
];
339-
340-
$scopeConfig = $this->objectManager->get(ScopeConfigInterface::class);
341-
342-
foreach ($testPaths as $path) {
343-
// Should not throw exception when accessing these paths
344-
$value = $scopeConfig->getValue($path);
345-
$this->assertTrue(true); // If we get here, path is accessible
346-
}
322+
$this->assertTrue(true);
347323
}
348324

349325
/**
350326
* Test error handling in deployment workflow
327+
* @throws LocalizedException
351328
*/
352329
public function testDeploymentWorkflowErrorHandling()
353330
{

0 commit comments

Comments
 (0)