mirror of https://github.com/jetkvm/kvm.git
fix test
This commit is contained in:
parent
18320edd97
commit
606e0769f9
|
@ -57,7 +57,22 @@ func TestValidateConfig(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateIPv4StaticConfigRequired(t *testing.T) {
|
func TestValidateIPv4StaticConfigNetmaskRequiredIfStatic(t *testing.T) {
|
||||||
|
config := &testNetworkConfig{
|
||||||
|
IPv4Static: &testIPv4StaticConfig{
|
||||||
|
Address: null.StringFrom("192.168.1.1"),
|
||||||
|
Gateway: null.StringFrom("192.168.1.1"),
|
||||||
|
},
|
||||||
|
IPv4Mode: null.StringFrom("static"),
|
||||||
|
}
|
||||||
|
|
||||||
|
err := SetDefaultsAndValidate(config)
|
||||||
|
if err == nil {
|
||||||
|
t.Fatalf("expected error, got nil")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestValidateIPv4StaticConfigNetmaskNotRequiredIfStatic(t *testing.T) {
|
||||||
config := &testNetworkConfig{
|
config := &testNetworkConfig{
|
||||||
IPv4Static: &testIPv4StaticConfig{
|
IPv4Static: &testIPv4StaticConfig{
|
||||||
Address: null.StringFrom("192.168.1.1"),
|
Address: null.StringFrom("192.168.1.1"),
|
||||||
|
@ -66,8 +81,8 @@ func TestValidateIPv4StaticConfigRequired(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
err := SetDefaultsAndValidate(config)
|
err := SetDefaultsAndValidate(config)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
t.Fatalf("expected error, got nil")
|
t.Fatalf("expected no error, got %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue