0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 10:33:46 +00:00
terraform-provider-proxmox/proxmoxtf/resource/validators/network_test.go
renovate[bot] 48756b69ba
chore(deps): update module github.com/golangci/golangci-lint (v1.56.2 → v1.57.1) in /tools (#1149)
* chore(deps): update module github.com/golangci/golangci-lint (v1.56.2 → v1.57.1) in /tools

| datasource | package                           | from    | to      |
| ---------- | --------------------------------- | ------- | ------- |
| go         | github.com/golangci/golangci-lint | v1.56.2 | v1.57.1 |

* fix linter errors

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-03-25 21:06:06 -04:00

46 lines
934 B
Go

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package validators
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestMACAddress(t *testing.T) {
t.Parallel()
tests := []struct {
name string
value string
valid bool
}{
{"empty", "", true},
{"invalid", "invalid", false},
{"invalid: no dashes", "38-f9-d3-4b-f5-51", false},
{"valid", "38:f9:d3:4b:f5:51", true},
{"valid", "38:F9:D3:4B:F5:51", true},
{"valid", "00:15:5d:00:09:03", true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
f := MACAddress()
res := f(tt.value, nil)
if tt.valid {
require.Empty(t, res, "validate: '%s'", tt.value)
} else {
require.NotEmpty(t, res, "validate: '%s'", tt.value)
}
})
}
}