Skip to content

Commit 1bd0b32

Browse files
authored
test: misc fixes and typos (#284)
Signed-off-by: Marc Nuri <[email protected]>
1 parent 0ec2599 commit 1bd0b32

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

pkg/mcp/helm_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ package mcp
33
import (
44
"context"
55
"encoding/base64"
6+
"path/filepath"
7+
"runtime"
8+
"strings"
9+
"testing"
10+
611
"github.com/containers/kubernetes-mcp-server/pkg/config"
712
"github.com/mark3labs/mcp-go/mcp"
813
corev1 "k8s.io/api/core/v1"
914
"k8s.io/apimachinery/pkg/api/errors"
1015
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1116
"k8s.io/client-go/kubernetes"
12-
"path/filepath"
13-
"runtime"
1417
"sigs.k8s.io/yaml"
15-
"strings"
16-
"testing"
1718
)
1819

1920
func TestHelmInstall(t *testing.T) {

pkg/mcp/mcp_tools_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package mcp
22

33
import (
4-
"github.com/mark3labs/mcp-go/client/transport"
5-
"github.com/mark3labs/mcp-go/mcp"
6-
"k8s.io/utils/ptr"
74
"regexp"
85
"strings"
96
"testing"
107

8+
"github.com/mark3labs/mcp-go/client/transport"
9+
"github.com/mark3labs/mcp-go/mcp"
10+
"k8s.io/utils/ptr"
11+
1112
"github.com/containers/kubernetes-mcp-server/pkg/config"
1213
)
1314

pkg/mcp/namespaces_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
package mcp
22

33
import (
4+
"regexp"
5+
"slices"
6+
"testing"
7+
48
"github.com/containers/kubernetes-mcp-server/pkg/config"
59
"github.com/containers/kubernetes-mcp-server/pkg/output"
610
"github.com/mark3labs/mcp-go/mcp"
711
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
812
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
913
"k8s.io/apimachinery/pkg/runtime/schema"
1014
"k8s.io/client-go/dynamic"
11-
"regexp"
1215
"sigs.k8s.io/yaml"
13-
"slices"
14-
"testing"
1516
)
1617

1718
func TestNamespacesList(t *testing.T) {

pkg/mcp/pods_exec_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func TestPodsExec(t *testing.T) {
5858
t.Fatalf("call tool failed %v", err)
5959
}
6060
if podsExecNilNamespace.IsError {
61-
t.Fatalf("call tool failed")
61+
t.Fatalf("call tool failed: %v", podsExecNilNamespace.Content)
6262
}
6363
if !strings.Contains(podsExecNilNamespace.Content[0].(mcp.TextContent).Text, "command:ls -l\n") {
6464
t.Errorf("unexpected result %v", podsExecNilNamespace.Content[0].(mcp.TextContent).Text)
@@ -74,9 +74,9 @@ func TestPodsExec(t *testing.T) {
7474
t.Fatalf("call tool failed %v", err)
7575
}
7676
if podsExecInNamespace.IsError {
77-
t.Fatalf("call tool failed")
77+
t.Fatalf("call tool failed: %v", podsExecInNamespace.Content)
7878
}
79-
if !strings.Contains(podsExecNilNamespace.Content[0].(mcp.TextContent).Text, "command:ls -l\n") {
79+
if !strings.Contains(podsExecInNamespace.Content[0].(mcp.TextContent).Text, "command:ls -l\n") {
8080
t.Errorf("unexpected result %v", podsExecInNamespace.Content[0].(mcp.TextContent).Text)
8181
}
8282
})

pkg/mcp/pods_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func TestPodsListInAllNamespacesUnauthorized(t *testing.T) {
9494
return
9595
}
9696
if toolResult.IsError {
97-
t.Fatalf("call tool failed")
97+
t.Fatalf("call tool failed %v", toolResult.Content)
9898
return
9999
}
100100
})

pkg/mcp/profiles_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package mcp
22

33
import (
4-
"github.com/mark3labs/mcp-go/mcp"
54
"slices"
65
"strings"
76
"testing"
7+
8+
"github.com/mark3labs/mcp-go/mcp"
89
)
910

1011
func TestFullProfileTools(t *testing.T) {

0 commit comments

Comments
 (0)