MCPcopy
hub / github.com/baetyl/baetyl / initCollectKubeAMI

Function initCollectKubeAMI

ami/kube/kube_collect_test.go:118–140  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

116}
117
118func initCollectKubeAMI(t *testing.T) *kubeImpl {
119 fc := fake.NewSimpleClientset(genCollectRuntime()...)
120 cli := client{
121 core: fc.CoreV1(),
122 app: fc.AppsV1(),
123 }
124 node, err := fc.CoreV1().Nodes().Get(context.TODO(), "node1", metav1.GetOptions{})
125 assert.NoError(t, err)
126 assert.NotNil(t, node)
127
128 se, err := fc.CoreV1().Secrets("baetyl-edge").Get(context.TODO(), "sec1", metav1.GetOptions{})
129 assert.NoError(t, err)
130 assert.NotNil(t, se)
131
132 f, err := os.CreateTemp("", t.Name())
133 assert.NoError(t, err)
134 assert.NotNil(t, f)
135 fmt.Println("-->tempfile", f.Name())
136 sto, err := store.NewBoltHold(f.Name())
137 assert.NoError(t, err)
138 assert.NotNil(t, sto)
139 return &kubeImpl{cli: &cli, store: sto, knn: "node1"}
140}
141
142func genCollectRuntime() []runtime.Object {
143 ns := "baetyl-edge"

Callers 1

TestCollectNodeInfoFunction · 0.85

Calls 3

NewBoltHoldFunction · 0.92
genCollectRuntimeFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected