@@ -146,7 +146,7 @@ describe('ClusterCommand unit tests', () => {
146
146
// @ts -expect-error - TS2344: Type CommandFlag does not satisfy the constraint string | number | symbol
147
147
stubbedFlags : Record < CommandFlag , any > [ ] = [ ] ,
148
148
opts : any = {
149
- testClusterConnectionError : false ,
149
+ testContextConnectionError : false ,
150
150
} ,
151
151
) => {
152
152
const loggerStub = sandbox . createStubInstance ( SoloLogger ) ;
@@ -156,10 +156,10 @@ describe('ClusterCommand unit tests', () => {
156
156
k8Stub . isPrometheusInstalled . returns ( new Promise < boolean > ( ( ) => true ) ) ;
157
157
k8Stub . isCertManagerInstalled . returns ( new Promise < boolean > ( ( ) => true ) ) ;
158
158
159
- if ( opts . testClusterConnectionError ) {
160
- k8Stub . testClusterConnection . resolves ( false ) ;
159
+ if ( opts . testContextConnectionError ) {
160
+ k8Stub . testContextConnection . resolves ( false ) ;
161
161
} else {
162
- k8Stub . testClusterConnection . resolves ( true ) ;
162
+ k8Stub . testContextConnection . resolves ( true ) ;
163
163
}
164
164
165
165
const kubeConfigClusterObject = {
@@ -465,7 +465,7 @@ describe('ClusterCommand unit tests', () => {
465
465
466
466
it ( 'throws error when context is invalid' , async ( ) => {
467
467
const opts = getBaseCommandOpts ( sandbox , { } , [ [ flags . context , 'invalid-context' ] ] , {
468
- testClusterConnectionError : true ,
468
+ testContextConnectionError : true ,
469
469
} ) ;
470
470
471
471
try {
@@ -545,8 +545,8 @@ describe('ClusterCommand unit tests', () => {
545
545
await runSubTasks ( subTasks ) ;
546
546
expect ( contextPromptStub ) . not . called ;
547
547
expect ( command . getK8 ( ) . setCurrentContext ) . to . have . been . calledWith ( 'context-2' ) ;
548
- expect ( command . getK8 ( ) . testClusterConnection ) . calledOnce ;
549
- expect ( command . getK8 ( ) . testClusterConnection ) . calledWith ( 'context-2' , 'cluster-2' ) ;
548
+ expect ( command . getK8 ( ) . testContextConnection ) . calledOnce ;
549
+ expect ( command . getK8 ( ) . testContextConnection ) . calledWith ( 'context-2' , 'cluster-2' ) ;
550
550
} ) ;
551
551
552
552
it ( 'should prompt for context when reading unknown cluster' , async ( ) => {
@@ -564,8 +564,8 @@ describe('ClusterCommand unit tests', () => {
564
564
await runSubTasks ( subTasks ) ;
565
565
expect ( contextPromptStub ) . calledOnce ;
566
566
expect ( command . getK8 ( ) . setCurrentContext ) . to . have . been . calledWith ( 'prompted-context' ) ;
567
- expect ( command . getK8 ( ) . testClusterConnection ) . calledOnce ;
568
- expect ( command . getK8 ( ) . testClusterConnection ) . calledWith ( 'prompted-context' , 'cluster-4' ) ;
567
+ expect ( command . getK8 ( ) . testContextConnection ) . calledOnce ;
568
+ expect ( command . getK8 ( ) . testContextConnection ) . calledWith ( 'prompted-context' , 'cluster-4' ) ;
569
569
} ) ;
570
570
571
571
it ( 'should throw error for invalid prompted context' , async ( ) => {
@@ -575,7 +575,7 @@ describe('ClusterCommand unit tests', () => {
575
575
'cluster-4' : 'deployment' ,
576
576
} ,
577
577
} ) ;
578
- const opts = getBaseCommandOpts ( sandbox , remoteConfig , [ ] , { testClusterConnectionError : true } ) ;
578
+ const opts = getBaseCommandOpts ( sandbox , remoteConfig , [ ] , { testContextConnectionError : true } ) ;
579
579
command = await runReadClustersFromRemoteConfigTask ( opts ) ;
580
580
expect ( taskStub . newListr ) . calledOnce ;
581
581
const subTasks = taskStub . newListr . firstCall . firstArg ;
@@ -586,8 +586,8 @@ describe('ClusterCommand unit tests', () => {
586
586
} catch ( e ) {
587
587
expect ( e . message ) . to . eq ( ErrorMessages . INVALID_CONTEXT_FOR_CLUSTER_DETAILED ( 'prompted-context' , 'cluster-4' ) ) ;
588
588
expect ( contextPromptStub ) . calledOnce ;
589
- expect ( command . getK8 ( ) . testClusterConnection ) . calledOnce ;
590
- expect ( command . getK8 ( ) . testClusterConnection ) . calledWith ( 'prompted-context' , 'cluster-4' ) ;
589
+ expect ( command . getK8 ( ) . testContextConnection ) . calledOnce ;
590
+ expect ( command . getK8 ( ) . testContextConnection ) . calledWith ( 'prompted-context' , 'cluster-4' ) ;
591
591
}
592
592
} ) ;
593
593
@@ -615,8 +615,8 @@ describe('ClusterCommand unit tests', () => {
615
615
} catch ( e ) {
616
616
expect ( e . message ) . to . eq ( ErrorMessages . REMOTE_CONFIGS_DO_NOT_MATCH ( 'cluster-3' , 'cluster-4' ) ) ;
617
617
expect ( contextPromptStub ) . calledOnce ;
618
- expect ( command . getK8 ( ) . testClusterConnection ) . calledOnce ;
619
- expect ( command . getK8 ( ) . testClusterConnection ) . calledWith ( 'prompted-context' , 'cluster-4' ) ;
618
+ expect ( command . getK8 ( ) . testContextConnection ) . calledOnce ;
619
+ expect ( command . getK8 ( ) . testContextConnection ) . calledWith ( 'prompted-context' , 'cluster-4' ) ;
620
620
}
621
621
} ) ;
622
622
} ) ;
0 commit comments