mirror of
https://github.com/luckfox-eng29/kvm.git
synced 2026-01-18 03:28:19 +01:00
chore: run golang tests
This commit is contained in:
@@ -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{
|
||||
IPv4Static: &testIPv4StaticConfig{
|
||||
Address: null.StringFrom("192.168.1.1"),
|
||||
@@ -66,8 +81,8 @@ func TestValidateIPv4StaticConfigRequired(t *testing.T) {
|
||||
}
|
||||
|
||||
err := SetDefaultsAndValidate(config)
|
||||
if err == nil {
|
||||
t.Fatalf("expected error, got nil")
|
||||
if err != nil {
|
||||
t.Fatalf("expected no error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user