MCPcopy
hub / github.com/baetyl/baetyl / TestUpdateNodeLabels

Function TestUpdateNodeLabels

ami/kube/kube_exec_test.go:86–109  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

84}
85
86func TestUpdateNodeLabels(t *testing.T) {
87 am := initExecKubeAMI(t)
88 oldLabels := map[string]string{
89 "beta.kubernetes.io/arch": "amd64",
90 "beta.kubernetes.io/os": "linux",
91 "kubernetes.io/arch": "amd64",
92 "kubernetes.io/hostname": "docker-desktop",
93 "kubernetes.io/os": "linux",
94 "node-role.kubernetes.io/master": "",
95 }
96 newLabels := map[string]string{
97 "a": "b",
98 }
99 no, err := am.cli.core.Nodes().Get(context.TODO(), "node1", metav1.GetOptions{})
100 assert.NoError(t, err)
101 assert.EqualValues(t, oldLabels, no.Labels)
102
103 err = am.UpdateNodeLabels("node1", newLabels)
104 assert.NoError(t, err)
105
106 no, err = am.cli.core.Nodes().Get(context.TODO(), "node1", metav1.GetOptions{})
107 assert.NoError(t, err)
108 assert.EqualValues(t, newLabels, no.Labels)
109}
110
111func TestWebsocket(t *testing.T) {
112 impl := initExecKubeAMI(t)

Callers

nothing calls this directly

Calls 3

initExecKubeAMIFunction · 0.85
GetMethod · 0.65
UpdateNodeLabelsMethod · 0.65

Tested by

no test coverage detected