Missing hyphen in dhcp template path. Unit tests.

This is a single character bug fix.
Broke this out into a function for testing.
This commit is contained in:
MatthewHink
2022-01-25 18:39:42 -05:00
parent b038a8817b
commit 51798e483c
2 changed files with 40 additions and 10 deletions

View File

@@ -0,0 +1,25 @@
package dhcp
import (
"testing"
)
func TestDhcpTemplateFile(t *testing.T) {
tests := []struct{
parameter string
expected string
}{
{"", "/usr/local/etc/warewulf/dhcp/default-dhcpd.conf"},
{"default", "/usr/local/etc/warewulf/dhcp/default-dhcpd.conf"},
{"static", "/usr/local/etc/warewulf/dhcp/static-dhcpd.conf"},
{"/test/absolute/path.conf", "/test/absolute/path.conf"},
}
for _, tt := range tests {
actual := dhcpTemplateFile(tt.parameter)
if actual != tt.expected {
t.Errorf("dhcpTemplateFile(%v) expected: %v, actual: %v",
tt.parameter, tt.expected, actual)
}
}
}