validator_test.go 414 B

12345678910111213141516171819
  1. package validator
  2. import (
  3. "testing"
  4. "nettool/internal/model"
  5. )
  6. func TestValidateAllowsStaticInterfaceWithoutIPv4Address(t *testing.T) {
  7. result := New().Validate(model.InterfaceConfig{
  8. Interface: "enp2s0",
  9. Dhcp4: false,
  10. Addresses: []model.InterfaceAddressConfig{},
  11. })
  12. if !result.Valid {
  13. t.Fatalf("expected configuration without IPv4 addresses to be valid, got errors: %v", result.Errors)
  14. }
  15. }