test: misc fixes and typos (#284)

Signed-off-by: Marc Nuri <marc@marcnuri.com>
This commit is contained in:
Marc Nuri
2025-08-26 15:38:05 +02:00
committed by GitHub
parent 0ec2599bd8
commit 1bd0b32976
6 changed files with 19 additions and 15 deletions

View File

@@ -3,17 +3,18 @@ package mcp
import (
"context"
"encoding/base64"
"path/filepath"
"runtime"
"strings"
"testing"
"github.com/containers/kubernetes-mcp-server/pkg/config"
"github.com/mark3labs/mcp-go/mcp"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"path/filepath"
"runtime"
"sigs.k8s.io/yaml"
"strings"
"testing"
)
func TestHelmInstall(t *testing.T) {

View File

@@ -1,13 +1,14 @@
package mcp
import (
"github.com/mark3labs/mcp-go/client/transport"
"github.com/mark3labs/mcp-go/mcp"
"k8s.io/utils/ptr"
"regexp"
"strings"
"testing"
"github.com/mark3labs/mcp-go/client/transport"
"github.com/mark3labs/mcp-go/mcp"
"k8s.io/utils/ptr"
"github.com/containers/kubernetes-mcp-server/pkg/config"
)

View File

@@ -1,6 +1,10 @@
package mcp
import (
"regexp"
"slices"
"testing"
"github.com/containers/kubernetes-mcp-server/pkg/config"
"github.com/containers/kubernetes-mcp-server/pkg/output"
"github.com/mark3labs/mcp-go/mcp"
@@ -8,10 +12,7 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
"regexp"
"sigs.k8s.io/yaml"
"slices"
"testing"
)
func TestNamespacesList(t *testing.T) {

View File

@@ -58,7 +58,7 @@ func TestPodsExec(t *testing.T) {
t.Fatalf("call tool failed %v", err)
}
if podsExecNilNamespace.IsError {
t.Fatalf("call tool failed")
t.Fatalf("call tool failed: %v", podsExecNilNamespace.Content)
}
if !strings.Contains(podsExecNilNamespace.Content[0].(mcp.TextContent).Text, "command:ls -l\n") {
t.Errorf("unexpected result %v", podsExecNilNamespace.Content[0].(mcp.TextContent).Text)
@@ -74,9 +74,9 @@ func TestPodsExec(t *testing.T) {
t.Fatalf("call tool failed %v", err)
}
if podsExecInNamespace.IsError {
t.Fatalf("call tool failed")
t.Fatalf("call tool failed: %v", podsExecInNamespace.Content)
}
if !strings.Contains(podsExecNilNamespace.Content[0].(mcp.TextContent).Text, "command:ls -l\n") {
if !strings.Contains(podsExecInNamespace.Content[0].(mcp.TextContent).Text, "command:ls -l\n") {
t.Errorf("unexpected result %v", podsExecInNamespace.Content[0].(mcp.TextContent).Text)
}
})

View File

@@ -94,7 +94,7 @@ func TestPodsListInAllNamespacesUnauthorized(t *testing.T) {
return
}
if toolResult.IsError {
t.Fatalf("call tool failed")
t.Fatalf("call tool failed %v", toolResult.Content)
return
}
})

View File

@@ -1,10 +1,11 @@
package mcp
import (
"github.com/mark3labs/mcp-go/mcp"
"slices"
"strings"
"testing"
"github.com/mark3labs/mcp-go/mcp"
)
func TestFullProfileTools(t *testing.T) {