Skip to content

Commit df63ede

Browse files
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 #318 * fix: update new replica set name format in tests --------- Co-authored-by: David Gamero <david340804@gmail.com>
1 parent c56f17f commit df63ede

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/types/kubectl.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,11 +635,10 @@ describe('Kubectl class', () => {
635635
it('gets new replica sets', async () => {
636636
const kubectl = new Kubectl(kubectlPath, testNamespace)
637637

638-
const newReplicaSetName = 'newreplicaset'
639-
const name = 'name'
638+
const name = 'my-app-6d4cf56db6'
640639
const describeReturn = {
641640
exitCode: 0,
642-
stdout: newReplicaSetName + name + ' ' + 'extra',
641+
stdout: `NewReplicaSet: ${name} (1/1 replicas created)`,
643642
stderr: ''
644643
}
645644

src/types/kubectl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class Kubectl {
8585
const stdout = result.stdout.split('\n')
8686
core.debug('stdout from getNewReplicaSet is ' + JSON.stringify(stdout))
8787
stdout.forEach((line: string) => {
88-
const newreplicaset = 'newreplicaset'
88+
const newreplicaset = 'newreplicaset:'
8989
if (line && line.toLowerCase().indexOf(newreplicaset) > -1) {
9090
core.debug(
9191
`found string of interest for replicaset, line is ${line}`

0 commit comments

Comments
 (0)