/
githubmirror
/
origin
Обзор
Документация
Войти
/
githubmirror
/
origin
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
pkg/monitor/monitorapi/identification_node_test.go
47 строк
987 B
Devan Goodwin
Rename temp Go fields to locator/message and serialize to match
19 апр 2024, 15:33
19 апр 2024, 15:33
12fe22e
Код
Авторство
О чём код?
package monitorapi import "testing" func TestGetNodeRoles(t *testing.T) { var testCases = []struct { event Interval expected string }{ { event: Interval{ Condition: Condition{}, }, expected: "", }, { event: Interval{ Condition: Condition{ Message: Message{Annotations: map[AnnotationKey]string{AnnotationRoles: "master"}}, }, }, expected: "master", }, { event: Interval{ Condition: Condition{ Message: Message{Annotations: map[AnnotationKey]string{AnnotationRoles: "worker"}}, }, }, expected: "worker", }, { event: Interval{ Condition: Condition{ Message: Message{Annotations: map[AnnotationKey]string{AnnotationRoles: "master,worker"}}, }, }, expected: "master,worker", }, } for i, tc := range testCases { if actual := GetNodeRoles(tc.event); tc.expected != actual { t.Errorf("mismatch node roles. test case:#%d expected: %s, actual: %s", i, tc.expected, actual) } } }