Skip to content

Commit 50c7c8e

Browse files
committed
AC-15461: Migration New Relic from REST v2 to NerdGraph (GraphQL)
1 parent 331ab3b commit 50c7c8e

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

app/code/Magento/NewRelicReporting/Console/Command/DeployMarker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ private function displayDeploymentDetails(OutputInterface $output, array $deploy
174174
) : 'N/A']
175175
];
176176

177-
if (!empty($deployment['changelog'])) {
178-
$rows[] = ['Changelog', $deployment['changelog']];
177+
if (!empty($deployment['change_log'])) {
178+
$rows[] = ['Change log', $deployment['change_log']];
179179
}
180180
if (!empty($deployment['commit'])) {
181181
$rows[] = ['Commit', $deployment['commit']];

app/code/Magento/NewRelicReporting/Model/NerdGraph/DeploymentTracker.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(
5151
* Create a deployment marker via NerdGraph
5252
*
5353
* @param string $description Deployment description
54-
* @param string|null $changelog Changelog or commit message
54+
* @param string|null $change commit message
5555
* @param string|null $user User who performed the deployment
5656
* @param string|null $version Version or revision
5757
* @param string|null $commit Git commit hash
@@ -61,7 +61,7 @@ public function __construct(
6161
*/
6262
public function createDeployment(
6363
string $description,
64-
?string $changelog = null,
64+
?string $change = null,
6565
?string $user = null,
6666
?string $version = null,
6767
?string $commit = null,
@@ -79,7 +79,7 @@ public function createDeployment(
7979
$entityGuid,
8080
$description,
8181
$version,
82-
$changelog,
82+
$change,
8383
$user,
8484
$commit,
8585
$deepLink,
@@ -92,7 +92,7 @@ public function createDeployment(
9292
$response,
9393
$variables,
9494
$description,
95-
$changelog,
95+
$change,
9696
$user,
9797
$commit,
9898
$deepLink,
@@ -163,7 +163,7 @@ private function getDeploymentMutation(): string
163163
* @param string $entityGuid
164164
* @param string $description
165165
* @param string|null $version
166-
* @param string|null $changelog
166+
* @param string|null $change
167167
* @param string|null $user
168168
* @param string|null $commit
169169
* @param string|null $deepLink
@@ -174,7 +174,7 @@ private function buildDeploymentVariables(
174174
string $entityGuid,
175175
string $description,
176176
?string $version,
177-
?string $changelog,
177+
?string $change,
178178
?string $user,
179179
?string $commit,
180180
?string $deepLink,
@@ -190,7 +190,7 @@ private function buildDeploymentVariables(
190190
]
191191
];
192192

193-
$this->addOptionalFields($variables, $changelog, $user, $commit, $deepLink, $groupId);
193+
$this->addOptionalFields($variables, $change, $user, $commit, $deepLink, $groupId);
194194

195195
return $variables;
196196
}
@@ -199,7 +199,7 @@ private function buildDeploymentVariables(
199199
* Add optional fields to deployment variables
200200
*
201201
* @param array $variables
202-
* @param string|null $changelog
202+
* @param string|null $change
203203
* @param string|null $user
204204
* @param string|null $commit
205205
* @param string|null $deepLink
@@ -208,14 +208,14 @@ private function buildDeploymentVariables(
208208
*/
209209
private function addOptionalFields(
210210
array &$variables,
211-
?string $changelog,
211+
?string $change,
212212
?string $user,
213213
?string $commit,
214214
?string $deepLink,
215215
?string $groupId
216216
): void {
217-
if ($changelog) {
218-
$variables['deployment']['changelog'] = $changelog;
217+
if ($change) {
218+
$variables['deployment']['change_log'] = $change;
219219
}
220220

221221
if ($user) {
@@ -241,7 +241,7 @@ private function addOptionalFields(
241241
* @param array $response
242242
* @param array $variables
243243
* @param string $description
244-
* @param string|null $changelog
244+
* @param string|null $change
245245
* @param string|null $user
246246
* @param string|null $commit
247247
* @param string|null $deepLink
@@ -252,7 +252,7 @@ private function processDeploymentResponse(
252252
array $response,
253253
array $variables,
254254
string $description,
255-
?string $changelog,
255+
?string $change,
256256
?string $user,
257257
?string $commit,
258258
?string $deepLink,
@@ -277,7 +277,7 @@ private function processDeploymentResponse(
277277
'entityGuid' => $deploymentData['entityGuid'],
278278
'version' => $deployedVersion,
279279
'description' => $description,
280-
'changelog' => $changelog,
280+
'change_log' => $change,
281281
'user' => $user,
282282
'commit' => $commit,
283283
'deepLink' => $deepLink,

app/code/Magento/NewRelicReporting/Test/Unit/Console/Command/DeployMarkerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function testExecuteSuccessWithArrayResultNerdGraphStyle()
181181
'description' => $message,
182182
'user' => $user,
183183
'timestamp' => 1234567890000, // Feb 13, 2009 23:31:30 UTC
184-
'changelog' => 'New features',
184+
'change_log' => 'New features',
185185
'commit' => $commit,
186186
'deepLink' => $deepLink,
187187
'groupId' => $groupId
@@ -452,7 +452,7 @@ public function testExecuteSuccessWithCompleteDeploymentDataNerdGraphStyle()
452452
'description' => $message,
453453
'user' => 'complete-user',
454454
'timestamp' => 1640995200000, // 2022-01-01 00:00:00 UTC
455-
'changelog' => 'Added new features',
455+
'change_log' => 'Added new features',
456456
'commit' => 'abc123def456',
457457
'deepLink' => 'https://github.com/test/releases/v2.0.0',
458458
'groupId' => 'production'

app/code/Magento/NewRelicReporting/Test/Unit/Model/NerdGraph/DeploymentTrackerTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected function setUp(): void
6565
public function testCreateDeploymentSuccess()
6666
{
6767
$description = 'Test deployment';
68-
$changelog = 'Bug fixes';
68+
$change = 'Bug fixes';
6969
$user = 'deploy-user';
7070
$version = 'v1.0.0';
7171
$commit = 'abc123';
@@ -86,7 +86,7 @@ public function testCreateDeploymentSuccess()
8686
'version' => $version,
8787
'description' => $description,
8888
'user' => $user,
89-
'changelog' => $changelog,
89+
'change_log' => $change,
9090
'commit' => $commit,
9191
'deepLink' => $deepLink,
9292
'groupId' => $groupId
@@ -102,7 +102,7 @@ public function testCreateDeploymentSuccess()
102102
$entityGuid,
103103
$description,
104104
$version,
105-
$changelog,
105+
$change,
106106
$user,
107107
$commit,
108108
$deepLink,
@@ -112,7 +112,7 @@ public function testCreateDeploymentSuccess()
112112
$variables['deployment']['entityGuid'] === $entityGuid &&
113113
$variables['deployment']['description'] === $description &&
114114
$variables['deployment']['version'] === $version &&
115-
$variables['deployment']['changelog'] === $changelog &&
115+
$variables['deployment']['change_log'] === $change &&
116116
$variables['deployment']['user'] === $user &&
117117
$variables['deployment']['commit'] === $commit &&
118118
$variables['deployment']['deepLink'] === $deepLink &&
@@ -127,7 +127,7 @@ public function testCreateDeploymentSuccess()
127127

128128
$result = $this->deploymentTracker->createDeployment(
129129
$description,
130-
$changelog,
130+
$change,
131131
$user,
132132
$version,
133133
$commit,
@@ -140,7 +140,7 @@ public function testCreateDeploymentSuccess()
140140
$this->assertEquals($entityGuid, $result['entityGuid']);
141141
$this->assertEquals($version, $result['version']);
142142
$this->assertEquals($description, $result['description']);
143-
$this->assertEquals($changelog, $result['changelog']);
143+
$this->assertEquals($change, $result['change_log']);
144144
$this->assertEquals($user, $result['user']);
145145
$this->assertEquals($commit, $result['commit']);
146146
$this->assertEquals($deepLink, $result['deepLink']);
@@ -180,7 +180,7 @@ public function testCreateDeploymentWithMinimalParameters()
180180
return isset($variables['deployment']) &&
181181
$variables['deployment']['entityGuid'] === $entityGuid &&
182182
$variables['deployment']['description'] === $description &&
183-
!isset($variables['deployment']['changelog']) &&
183+
!isset($variables['deployment']['change_log']) &&
184184
!isset($variables['deployment']['user']);
185185
})
186186
)
@@ -527,7 +527,7 @@ public function testCreateDeploymentWithSpecialCharacters()
527527
public function testCreateDeploymentWithLongParameters()
528528
{
529529
$description = str_repeat('A', 1000);
530-
$changelog = str_repeat('B', 2000);
530+
$change = str_repeat('B', 2000);
531531
$user = str_repeat('C', 100);
532532
$entityGuid = 'TEST_ENTITY_GUID';
533533

@@ -542,7 +542,7 @@ public function testCreateDeploymentWithLongParameters()
542542
'entityGuid' => $entityGuid,
543543
'timestamp' => 1234567890000,
544544
'description' => $description,
545-
'changelog' => $changelog,
545+
'change_log' => $change,
546546
'user' => $user
547547
]
548548
]
@@ -556,7 +556,7 @@ public function testCreateDeploymentWithLongParameters()
556556
->method('info')
557557
->with('NerdGraph deployment created successfully');
558558

559-
$result = $this->deploymentTracker->createDeployment($description, $changelog, $user);
559+
$result = $this->deploymentTracker->createDeployment($description, $change, $user);
560560

561561
$this->assertIsArray($result);
562562
$this->assertArrayHasKey('deploymentId', $result);
@@ -568,7 +568,7 @@ public function testCreateDeploymentWithLongParameters()
568568
public function testCreateDeploymentMutationStructure()
569569
{
570570
$description = 'Test deployment';
571-
$changelog = 'Bug fixes';
571+
$change = 'Bug fixes';
572572
$user = 'deploy-user';
573573
$version = 'v1.0.0';
574574
$commit = 'abc123';
@@ -596,7 +596,7 @@ public function testCreateDeploymentMutationStructure()
596596
$this->callback(function ($variables) use (
597597
$entityGuid,
598598
$description,
599-
$changelog,
599+
$change,
600600
$user,
601601
$version,
602602
$commit,
@@ -606,7 +606,7 @@ public function testCreateDeploymentMutationStructure()
606606
return isset($variables['deployment']) &&
607607
$variables['deployment']['entityGuid'] === $entityGuid &&
608608
$variables['deployment']['description'] === $description &&
609-
$variables['deployment']['changelog'] === $changelog &&
609+
$variables['deployment']['change_log'] === $change &&
610610
$variables['deployment']['user'] === $user &&
611611
$variables['deployment']['version'] === $version &&
612612
$variables['deployment']['commit'] === $commit &&
@@ -622,7 +622,7 @@ public function testCreateDeploymentMutationStructure()
622622

623623
$result = $this->deploymentTracker->createDeployment(
624624
$description,
625-
$changelog,
625+
$change,
626626
$user,
627627
$version,
628628
$commit,

0 commit comments

Comments
 (0)