From df63ede790f5d53cec85b362a2fe44dfe60815a6 Mon Sep 17 00:00:00 2001 From: Ogheneobukome Ejaife <97336369+ejaifeobuks@users.noreply.github.com> Date: Tue, 28 Jul 2026 21:38:10 -0700 Subject: [PATCH] fix: strip colon from parsed NewReplicaSet name (#543) * fix: strip colon from parsed NewReplicaSet name Include the trailing colon in the 'newreplicaset:' keyword so substring() removes "NewReplicaSet:" entirely. Previously the colon was left behind, causing getNewReplicaSet to return ":" instead of the actual ReplicaSet name. Also update the getNewReplicaSet unit test to use realistic colon-delimited `kubectl describe` output, which the previous mock omitted. Resolves azure/k8s-deploy#318 * fix: update new replica set name format in tests --------- Co-authored-by: David Gamero --- src/types/kubectl.test.ts | 5 ++--- src/types/kubectl.ts | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/types/kubectl.test.ts b/src/types/kubectl.test.ts index ca1e09ac..9e6a4cae 100644 --- a/src/types/kubectl.test.ts +++ b/src/types/kubectl.test.ts @@ -635,11 +635,10 @@ describe('Kubectl class', () => { it('gets new replica sets', async () => { const kubectl = new Kubectl(kubectlPath, testNamespace) - const newReplicaSetName = 'newreplicaset' - const name = 'name' + const name = 'my-app-6d4cf56db6' const describeReturn = { exitCode: 0, - stdout: newReplicaSetName + name + ' ' + 'extra', + stdout: `NewReplicaSet: ${name} (1/1 replicas created)`, stderr: '' } diff --git a/src/types/kubectl.ts b/src/types/kubectl.ts index cba80146..c525dedf 100644 --- a/src/types/kubectl.ts +++ b/src/types/kubectl.ts @@ -85,7 +85,7 @@ export class Kubectl { const stdout = result.stdout.split('\n') core.debug('stdout from getNewReplicaSet is ' + JSON.stringify(stdout)) stdout.forEach((line: string) => { - const newreplicaset = 'newreplicaset' + const newreplicaset = 'newreplicaset:' if (line && line.toLowerCase().indexOf(newreplicaset) > -1) { core.debug( `found string of interest for replicaset, line is ${line}`