Created
March 29, 2022 16:28
-
-
Save eumel8/6a2a0d50b073f30cee24822aced9a5aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pod | |
import ( | |
"context" | |
"testing" | |
core "k8s.io/api/core/v1" | |
meta "k8s.io/apimachinery/pkg/apis/meta/v1" | |
"k8s.io/client-go/kubernetes/fake" | |
) | |
func TestPod(t *testing.T) { | |
client := fake.NewSimpleClientset() | |
p := &core.Pod{ObjectMeta: meta.ObjectMeta{Name: "my-pod"}} | |
result, err := client.CoreV1().Pods("test-ns").Create(context.TODO(), p, meta.CreateOptions{}) | |
if err != nil { | |
t.Fatalf("error injecting pod add: %v", err) | |
} | |
t.Logf("Got pod from manifest: %v", p.ObjectMeta.Name) | |
t.Logf("Got pod from result: %v", result.ObjectMeta.Name) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment