@@ -4,6 +4,13 @@ import (
44	"context" 
55	"encoding/json" 
66	"fmt" 
7+ 	"net/http/httptest" 
8+ 	"os" 
9+ 	"path/filepath" 
10+ 	"runtime" 
11+ 	"testing" 
12+ 	"time" 
13+ 
714	"github.com/manusa/kubernetes-mcp-server/pkg/config" 
815	"github.com/manusa/kubernetes-mcp-server/pkg/output" 
916	"github.com/mark3labs/mcp-go/client" 
@@ -28,18 +35,12 @@ import (
2835	"k8s.io/client-go/tools/clientcmd/api" 
2936	toolswatch "k8s.io/client-go/tools/watch" 
3037	"k8s.io/utils/ptr" 
31- 	"net/http/httptest" 
32- 	"os" 
33- 	"path/filepath" 
34- 	"runtime" 
3538	"sigs.k8s.io/controller-runtime/pkg/envtest" 
3639	"sigs.k8s.io/controller-runtime/tools/setup-envtest/env" 
3740	"sigs.k8s.io/controller-runtime/tools/setup-envtest/remote" 
3841	"sigs.k8s.io/controller-runtime/tools/setup-envtest/store" 
3942	"sigs.k8s.io/controller-runtime/tools/setup-envtest/versions" 
4043	"sigs.k8s.io/controller-runtime/tools/setup-envtest/workflows" 
41- 	"testing" 
42- 	"time" 
4344)
4445
4546// envTest has an expensive setup, so we only want to do it once per entire test run. 
@@ -97,20 +98,19 @@ func TestMain(m *testing.M) {
9798}
9899
99100type  mcpContext  struct  {
100- 	profile             Profile 
101- 	listOutput          output.Output 
102- 	readOnly            bool 
103- 	disableDestructive  bool 
104- 	staticConfig        * config.StaticConfig 
105- 	clientOptions       []transport.ClientOption 
106- 	before              func (* mcpContext )
107- 	after               func (* mcpContext )
108- 	ctx                 context.Context 
109- 	tempDir             string 
110- 	cancel              context.CancelFunc 
111- 	mcpServer           * Server 
112- 	mcpHttpServer       * httptest.Server 
113- 	mcpClient           * client.Client 
101+ 	profile     Profile 
102+ 	listOutput  output.Output 
103+ 
104+ 	staticConfig   * config.StaticConfig 
105+ 	clientOptions  []transport.ClientOption 
106+ 	before         func (* mcpContext )
107+ 	after          func (* mcpContext )
108+ 	ctx            context.Context 
109+ 	tempDir        string 
110+ 	cancel         context.CancelFunc 
111+ 	mcpServer      * Server 
112+ 	mcpHttpServer  * httptest.Server 
113+ 	mcpClient      * client.Client 
114114}
115115
116116func  (c  * mcpContext ) beforeEach (t  * testing.T ) {
@@ -125,17 +125,18 @@ func (c *mcpContext) beforeEach(t *testing.T) {
125125		c .listOutput  =  output .Yaml 
126126	}
127127	if  c .staticConfig  ==  nil  {
128- 		c .staticConfig  =  & config.StaticConfig {}
128+ 		c .staticConfig  =  & config.StaticConfig {
129+ 			ReadOnly :           false ,
130+ 			DisableDestructive : false ,
131+ 		}
129132	}
130133	if  c .before  !=  nil  {
131134		c .before (c )
132135	}
133136	if  c .mcpServer , err  =  NewServer (Configuration {
134- 		Profile :            c .profile ,
135- 		ListOutput :         c .listOutput ,
136- 		ReadOnly :           c .readOnly ,
137- 		DisableDestructive : c .disableDestructive ,
138- 		StaticConfig :       c .staticConfig ,
137+ 		Profile :      c .profile ,
138+ 		ListOutput :   c .listOutput ,
139+ 		StaticConfig : c .staticConfig ,
139140	}); err  !=  nil  {
140141		t .Fatal (err )
141142		return 
0 commit comments