File tree Expand file tree Collapse file tree 2 files changed +11
-16
lines changed Expand file tree Collapse file tree 2 files changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -123,11 +123,15 @@ func (opts *logoutOpts) Run(ctx context.Context) error {
123123 opts .config .SetProjectID ("" )
124124 opts .config .SetOrgID ("" )
125125
126+ if err := opts .config .Save (); err != nil {
127+ return err
128+ }
129+
126130 if ! opts .keepConfig {
127131 return opts .Delete (opts .config .Delete )
128132 }
129133
130- return opts . config . Save ()
134+ return nil
131135}
132136
133137func LogoutBuilder () * cobra.Command {
Original file line number Diff line number Diff line change @@ -165,11 +165,6 @@ func Test_logoutOpts_Run_Keep_UserAccount(t *testing.T) {
165165
166166 mockConfigCleanUp (mockConfig )
167167 mockProjectAndOrgCleanUp (mockConfig )
168- mockConfig .
169- EXPECT ().
170- Save ().
171- Return (nil ).
172- Times (1 )
173168
174169 require .NoError (t , opts .Run (ctx ))
175170}
@@ -199,11 +194,6 @@ func Test_logoutOpts_Run_Keep_APIKeys(t *testing.T) {
199194
200195 mockConfigCleanUp (mockConfig )
201196 mockProjectAndOrgCleanUp (mockConfig )
202- mockConfig .
203- EXPECT ().
204- Save ().
205- Return (nil ).
206- Times (1 )
207197
208198 require .NoError (t , opts .Run (ctx ))
209199}
@@ -236,11 +226,6 @@ func Test_logoutOpts_Run_Keep_ServiceAccount(t *testing.T) {
236226
237227 mockConfigCleanUp (mockConfig )
238228 mockProjectAndOrgCleanUp (mockConfig )
239- mockConfig .
240- EXPECT ().
241- Save ().
242- Return (nil ).
243- Times (1 )
244229
245230 require .NoError (t , opts .Run (ctx ))
246231}
@@ -305,6 +290,12 @@ func mockConfigCleanUp(mockConfig *MockConfigDeleter) {
305290 EXPECT ().
306291 SetPrivateAPIKey ("" ).
307292 Times (1 )
293+
294+ mockConfig .
295+ EXPECT ().
296+ Save ().
297+ Return (nil ).
298+ Times (1 )
308299}
309300
310301func mockProjectAndOrgCleanUp (mockConfig * MockConfigDeleter ) {
You can’t perform that action at this time.
0 commit comments