@@ -63,6 +63,30 @@ suite('K8s/deployment', () => {
6363 }
6464 }` ;
6565
66+ const context = {
67+ id : "dummy" ,
68+ impl : {
69+ id : "rc/comp1-app-2" ,
70+ kind : {
71+ manifestKind : "ReplicationController" ,
72+ abbreviation : "rc"
73+ } ,
74+ namespace : "myproject" ,
75+ name : "comp1-app-2" ,
76+ number : 2 ,
77+ manifest : "ReplicationController" ,
78+ metadata : undefined ,
79+ node : "rc" ,
80+ resourceId : "rc/comp1-app-2"
81+ } ,
82+ resourceKind : {
83+ manifestKind : "ReplicationController" ,
84+ abbreviation : "rc"
85+ } ,
86+ nodeCategory : "kubernetes-explorer-node" ,
87+ nodeType : "extension"
88+ } ;
89+
6690 setup ( ( ) => {
6791 sandbox = sinon . createSandbox ( ) ;
6892 termStub = sandbox . stub ( OdoImpl . prototype , 'executeInTerminal' ) ;
@@ -167,30 +191,35 @@ suite('K8s/deployment', () => {
167191 } ) ;
168192 } ) ;
169193
194+ suite ( 'Show Replica Log' , ( ) => {
195+
196+ setup ( ( ) => {
197+ execStub . resolves ( { error : null , stdout : mockData , stderr : '' } ) ;
198+ const deploymentConfig = { label : "comp1-app" } ;
199+ sandbox . stub ( DeploymentConfig , 'getReplicaNames' ) . resolves ( [ "comp1-app-1" , "comp1-app-2" ] ) ;
200+ quickPickStub = sandbox . stub ( vscode . window , 'showQuickPick' ) ;
201+ quickPickStub . onFirstCall ( ) . resolves ( deploymentConfig ) ;
202+ quickPickStub . onSecondCall ( ) . resolves ( "comp1-app-1" ) ;
203+ } ) ;
204+
205+ test ( 'works from context menu' , async ( ) => {
206+ await DeploymentConfig . rcShowLog ( context ) ;
207+ expect ( termStub ) . calledOnceWith ( Command . showLog ( "comp1-app-2" ) ) ;
208+ } ) ;
209+
210+ test ( 'works with no context' , async ( ) => {
211+ await DeploymentConfig . rcShowLog ( null ) ;
212+ expect ( termStub ) . calledOnceWith ( Command . showLog ( 'comp1-app-1' ) ) ;
213+ } ) ;
214+
215+ test ( 'returns null when no replica selected' , async ( ) => {
216+ quickPickStub . onSecondCall ( ) . resolves ( ) ;
217+ const result = await DeploymentConfig . rcShowLog ( null ) ;
218+ expect ( result ) . null ;
219+ } ) ;
220+ } ) ;
221+
170222 suite ( 'Delete' , ( ) => {
171- const context = {
172- id : "dummy" ,
173- impl : {
174- id : "rc/comp1-app-2" ,
175- kind : {
176- manifestKind : "ReplicationController" ,
177- abbreviation : "rc"
178- } ,
179- namespace : "myproject" ,
180- name : "comp1-app-2" ,
181- number : 2 ,
182- manifest : "ReplicationController" ,
183- metadata : undefined ,
184- node : "rc" ,
185- resourceId : "rc/comp1-app-2"
186- } ,
187- resourceKind : {
188- manifestKind : "ReplicationController" ,
189- abbreviation : "rc"
190- } ,
191- nodeCategory : "kubernetes-explorer-node" ,
192- nodeType : "extension"
193- } ;
194223
195224 const deploymentData = `comp1-app-1\\ncomp1-app-2` ;
196225
0 commit comments