File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ func (c *mcpContext) beforeEach(t *testing.T) {
89
89
var err error
90
90
c .ctx , c .cancel = context .WithCancel (context .Background ())
91
91
c .tempDir = t .TempDir ()
92
- _ = os . Unsetenv ( "KUBECONFIG" )
92
+ c . withKubeConfig ( nil )
93
93
if c .mcpServer , err = NewSever (); err != nil {
94
94
t .Fatal (err )
95
95
return
@@ -99,7 +99,6 @@ func (c *mcpContext) beforeEach(t *testing.T) {
99
99
t .Fatal (err )
100
100
return
101
101
}
102
- c .withKubeConfig (nil )
103
102
if err = c .mcpClient .Start (c .ctx ); err != nil {
104
103
t .Fatal (err )
105
104
return
@@ -146,8 +145,10 @@ func (c *mcpContext) withKubeConfig(rc *rest.Config) *api.Config {
146
145
kubeConfig := filepath .Join (c .tempDir , "config" )
147
146
_ = clientcmd .WriteToFile (* fakeConfig , kubeConfig )
148
147
_ = os .Setenv ("KUBECONFIG" , kubeConfig )
149
- if err := c .mcpServer .reloadKubernetesClient (); err != nil {
150
- panic (err )
148
+ if c .mcpServer != nil {
149
+ if err := c .mcpServer .reloadKubernetesClient (); err != nil {
150
+ panic (err )
151
+ }
151
152
}
152
153
return fakeConfig
153
154
}
You can’t perform that action at this time.
0 commit comments