mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #100575 from ZP-AlwaysWin/dev-moons
Add unit tests and fix scenarios not covered in unit tests
This commit is contained in:
commit
7edb592e3d
@ -6531,14 +6531,14 @@ func TestValidateRestartPolicy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidateDNSPolicy(t *testing.T) {
|
||||
successCases := []core.DNSPolicy{core.DNSClusterFirst, core.DNSDefault, core.DNSPolicy(core.DNSClusterFirst), core.DNSNone}
|
||||
successCases := []core.DNSPolicy{core.DNSClusterFirst, core.DNSDefault, core.DNSClusterFirstWithHostNet, core.DNSNone}
|
||||
for _, policy := range successCases {
|
||||
if errs := validateDNSPolicy(&policy, field.NewPath("field")); len(errs) != 0 {
|
||||
t.Errorf("expected success: %v", errs)
|
||||
}
|
||||
}
|
||||
|
||||
errorCases := []core.DNSPolicy{core.DNSPolicy("invalid")}
|
||||
errorCases := []core.DNSPolicy{core.DNSPolicy("invalid"), core.DNSPolicy("")}
|
||||
for _, policy := range errorCases {
|
||||
if errs := validateDNSPolicy(&policy, field.NewPath("field")); len(errs) == 0 {
|
||||
t.Errorf("expected failure for %v", policy)
|
||||
|
Loading…
Reference in New Issue
Block a user