11package mcp
22
33import (
4+ "testing"
5+
46 "github.com/containers/kubernetes-mcp-server/pkg/kubernetes"
57 "github.com/mark3labs/mcp-go/mcp"
68 "k8s.io/client-go/rest"
79 v1 "k8s.io/client-go/tools/clientcmd/api/v1"
810 "sigs.k8s.io/yaml"
9- "testing"
1011)
1112
1213func TestConfigurationView (t * testing.T ) {
@@ -31,7 +32,7 @@ func TestConfigurationView(t *testing.T) {
3132 })
3233 t .Run ("configuration_view returns context info" , func (t * testing.T ) {
3334 if len (decoded .Contexts ) != 1 {
34- t .Errorf ("invalid context count, expected 1, got %v" , len (decoded .Contexts ))
35+ t .Fatalf ("invalid context count, expected 1, got %v" , len (decoded .Contexts ))
3536 }
3637 if decoded .Contexts [0 ].Name != "fake-context" {
3738 t .Errorf ("fake-context not found: %v" , decoded .Contexts )
@@ -45,7 +46,7 @@ func TestConfigurationView(t *testing.T) {
4546 })
4647 t .Run ("configuration_view returns cluster info" , func (t * testing.T ) {
4748 if len (decoded .Clusters ) != 1 {
48- t .Errorf ("invalid cluster count, expected 1, got %v" , len (decoded .Clusters ))
49+ t .Fatalf ("invalid cluster count, expected 1, got %v" , len (decoded .Clusters ))
4950 }
5051 if decoded .Clusters [0 ].Name != "fake" {
5152 t .Errorf ("fake-cluster not found: %v" , decoded .Clusters )
@@ -56,7 +57,7 @@ func TestConfigurationView(t *testing.T) {
5657 })
5758 t .Run ("configuration_view returns auth info" , func (t * testing.T ) {
5859 if len (decoded .AuthInfos ) != 1 {
59- t .Errorf ("invalid auth info count, expected 1, got %v" , len (decoded .AuthInfos ))
60+ t .Fatalf ("invalid auth info count, expected 1, got %v" , len (decoded .AuthInfos ))
6061 }
6162 if decoded .AuthInfos [0 ].Name != "fake" {
6263 t .Errorf ("fake-auth not found: %v" , decoded .AuthInfos )
@@ -78,7 +79,7 @@ func TestConfigurationView(t *testing.T) {
7879 })
7980 t .Run ("configuration_view with minified=false returns additional context info" , func (t * testing.T ) {
8081 if len (decoded .Contexts ) != 2 {
81- t .Errorf ("invalid context count, expected2 , got %v" , len (decoded .Contexts ))
82+ t .Fatalf ("invalid context count, expected 2 , got %v" , len (decoded .Contexts ))
8283 }
8384 if decoded .Contexts [0 ].Name != "additional-context" {
8485 t .Errorf ("additional-context not found: %v" , decoded .Contexts )
@@ -95,15 +96,15 @@ func TestConfigurationView(t *testing.T) {
9596 })
9697 t .Run ("configuration_view with minified=false returns cluster info" , func (t * testing.T ) {
9798 if len (decoded .Clusters ) != 2 {
98- t .Errorf ("invalid cluster count, expected 2, got %v" , len (decoded .Clusters ))
99+ t .Fatalf ("invalid cluster count, expected 2, got %v" , len (decoded .Clusters ))
99100 }
100101 if decoded .Clusters [0 ].Name != "additional-cluster" {
101102 t .Errorf ("additional-cluster not found: %v" , decoded .Clusters )
102103 }
103104 })
104105 t .Run ("configuration_view with minified=false returns auth info" , func (t * testing.T ) {
105106 if len (decoded .AuthInfos ) != 2 {
106- t .Errorf ("invalid auth info count, expected 2, got %v" , len (decoded .AuthInfos ))
107+ t .Fatalf ("invalid auth info count, expected 2, got %v" , len (decoded .AuthInfos ))
107108 }
108109 if decoded .AuthInfos [0 ].Name != "additional-auth" {
109110 t .Errorf ("additional-auth not found: %v" , decoded .AuthInfos )
0 commit comments