all the refactor
Build and Publish / BuildAndDeployAmd64 (push) Failing after 5s
Build and Publish / BuildAndDeployArm64 (push) Failing after 6s

This commit is contained in:
2026-06-28 17:51:52 +02:00
parent 7db0d236c7
commit aa8b2bdedc
84 changed files with 4328 additions and 2344 deletions
+23 -7
View File
@@ -1,6 +1,8 @@
package discovery
import (
"os"
"path/filepath"
"testing"
"time"
@@ -9,14 +11,27 @@ import (
"k8s.io/client-go/tools/clientcmd"
)
func TestDiscovery(t *testing.T) {
config, err := clientcmd.BuildConfigFromFlags("", "/home/mats/.kube/config")
func kubeConfigPath(t *testing.T) string {
home, err := os.UserHomeDir()
if err != nil {
t.Errorf("Error building config: %v", err)
t.Skip("Skipping test: user home dir not found")
}
path := filepath.Join(home, ".kube", "config")
if _, err := os.Stat(path); os.IsNotExist(err) {
t.Skipf("Skipping test: %s not found", path)
}
return path
}
func TestDiscovery(t *testing.T) {
path := kubeConfigPath(t)
config, err := clientcmd.BuildConfigFromFlags("", path)
if err != nil {
t.Fatalf("Error building config: %v", err)
}
client, err := kubernetes.NewForConfig(config)
if err != nil {
t.Errorf("Error creating client: %v", err)
t.Fatalf("Error creating client: %v", err)
}
d := NewK8sDiscovery(client, metav1.ListOptions{
LabelSelector: "app",
@@ -31,13 +46,14 @@ func TestDiscovery(t *testing.T) {
}
func TestWatch(t *testing.T) {
config, err := clientcmd.BuildConfigFromFlags("", "/home/mats/.kube/config")
path := kubeConfigPath(t)
config, err := clientcmd.BuildConfigFromFlags("", path)
if err != nil {
t.Errorf("Error building config: %v", err)
t.Fatalf("Error building config: %v", err)
}
client, err := kubernetes.NewForConfig(config)
if err != nil {
t.Errorf("Error creating client: %v", err)
t.Fatalf("Error creating client: %v", err)
}
d := NewK8sDiscovery(client, metav1.ListOptions{
LabelSelector: "app",