mirror of
https://github.com/containers/kubernetes-mcp-server.git
synced 2025-10-23 01:22:57 +03:00
test: misc fixes and typos (#284)
Signed-off-by: Marc Nuri <marc@marcnuri.com>
This commit is contained in:
@@ -3,17 +3,18 @@ package mcp
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
|
||||||
"github.com/containers/kubernetes-mcp-server/pkg/config"
|
"github.com/containers/kubernetes-mcp-server/pkg/config"
|
||||||
"github.com/mark3labs/mcp-go/mcp"
|
"github.com/mark3labs/mcp-go/mcp"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"path/filepath"
|
|
||||||
"runtime"
|
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
"strings"
|
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHelmInstall(t *testing.T) {
|
func TestHelmInstall(t *testing.T) {
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package mcp
|
package mcp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mark3labs/mcp-go/client/transport"
|
|
||||||
"github.com/mark3labs/mcp-go/mcp"
|
|
||||||
"k8s.io/utils/ptr"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"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"
|
"github.com/containers/kubernetes-mcp-server/pkg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package mcp
|
package mcp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"regexp"
|
||||||
|
"slices"
|
||||||
|
"testing"
|
||||||
|
|
||||||
"github.com/containers/kubernetes-mcp-server/pkg/config"
|
"github.com/containers/kubernetes-mcp-server/pkg/config"
|
||||||
"github.com/containers/kubernetes-mcp-server/pkg/output"
|
"github.com/containers/kubernetes-mcp-server/pkg/output"
|
||||||
"github.com/mark3labs/mcp-go/mcp"
|
"github.com/mark3labs/mcp-go/mcp"
|
||||||
@@ -8,10 +12,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/client-go/dynamic"
|
"k8s.io/client-go/dynamic"
|
||||||
"regexp"
|
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
"slices"
|
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNamespacesList(t *testing.T) {
|
func TestNamespacesList(t *testing.T) {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ func TestPodsExec(t *testing.T) {
|
|||||||
t.Fatalf("call tool failed %v", err)
|
t.Fatalf("call tool failed %v", err)
|
||||||
}
|
}
|
||||||
if podsExecNilNamespace.IsError {
|
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") {
|
if !strings.Contains(podsExecNilNamespace.Content[0].(mcp.TextContent).Text, "command:ls -l\n") {
|
||||||
t.Errorf("unexpected result %v", podsExecNilNamespace.Content[0].(mcp.TextContent).Text)
|
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)
|
t.Fatalf("call tool failed %v", err)
|
||||||
}
|
}
|
||||||
if podsExecInNamespace.IsError {
|
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)
|
t.Errorf("unexpected result %v", podsExecInNamespace.Content[0].(mcp.TextContent).Text)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ func TestPodsListInAllNamespacesUnauthorized(t *testing.T) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if toolResult.IsError {
|
if toolResult.IsError {
|
||||||
t.Fatalf("call tool failed")
|
t.Fatalf("call tool failed %v", toolResult.Content)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package mcp
|
package mcp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mark3labs/mcp-go/mcp"
|
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/mark3labs/mcp-go/mcp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFullProfileTools(t *testing.T) {
|
func TestFullProfileTools(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user