Files
backrest/internal/orchestrator/tasks/hookvars_test.go
2024-10-19 17:18:04 -07:00

24 lines
554 B
Go

package tasks
import (
"testing"
v1 "github.com/garethgeorge/backrest/gen/go/v1"
)
func TestHookVarsEventName(t *testing.T) {
// for every value of condition, check that the event name is correct
values := v1.Hook_Condition(0).Descriptor().Values()
for i := 0; i < values.Len(); i++ {
condition := v1.Hook_Condition(values.Get(i).Number())
if condition == v1.Hook_CONDITION_UNKNOWN {
continue
}
vars := HookVars{}
if vars.EventName(condition) == "unknown" {
t.Errorf("unexpected event name for condition %v", condition)
}
}
}