fix ethernet_test
This commit is contained in:
@@ -49,7 +49,7 @@ func (t EthernetDisconnect) Listen() {
|
|||||||
actions.Fire(t.action)
|
actions.Fire(t.action)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e EthernetDisconnect) Create(config internal.KillSwitchConfig) (Trigger, error) {
|
func CreateEthernetDisconnect(config internal.KillSwitchConfig) (EthernetDisconnect, error) {
|
||||||
result := EthernetDisconnect{
|
result := EthernetDisconnect{
|
||||||
WaitTillConnected: true,
|
WaitTillConnected: true,
|
||||||
}
|
}
|
||||||
@@ -75,6 +75,10 @@ func (e EthernetDisconnect) Create(config internal.KillSwitchConfig) (Trigger, e
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (e EthernetDisconnect) Create(config internal.KillSwitchConfig) (Trigger, error) {
|
||||||
|
return CreateEthernetDisconnect(config)
|
||||||
|
}
|
||||||
|
|
||||||
func (p EthernetDisconnect) GetName() string {
|
func (p EthernetDisconnect) GetName() string {
|
||||||
return "EthernetDisconnect"
|
return "EthernetDisconnect"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func TestEthernetDisconnetConfig(t *testing.T) {
|
|||||||
},
|
},
|
||||||
EthernetTest{
|
EthernetTest{
|
||||||
testConfig: internal.KillSwitchConfig{
|
testConfig: internal.KillSwitchConfig{
|
||||||
Options: []byte(`{
|
Options: []byte(`{
|
||||||
"waitTillConnected": false
|
"waitTillConnected": false
|
||||||
}`),
|
}`),
|
||||||
},
|
},
|
||||||
@@ -34,7 +34,7 @@ func TestEthernetDisconnetConfig(t *testing.T) {
|
|||||||
},
|
},
|
||||||
EthernetTest{
|
EthernetTest{
|
||||||
testConfig: internal.KillSwitchConfig{
|
testConfig: internal.KillSwitchConfig{
|
||||||
Options: []byte(`{
|
Options: []byte(`{
|
||||||
"interfaceName": "eth0",
|
"interfaceName": "eth0",
|
||||||
"waitTillConnected": false
|
"waitTillConnected": false
|
||||||
}`),
|
}`),
|
||||||
@@ -45,7 +45,7 @@ func TestEthernetDisconnetConfig(t *testing.T) {
|
|||||||
},
|
},
|
||||||
EthernetTest{
|
EthernetTest{
|
||||||
testConfig: internal.KillSwitchConfig{
|
testConfig: internal.KillSwitchConfig{
|
||||||
Options: []byte(`{
|
Options: []byte(`{
|
||||||
"interfaceName": "eth0",
|
"interfaceName": "eth0",
|
||||||
"waitTillConnected": true
|
"waitTillConnected": true
|
||||||
}`),
|
}`),
|
||||||
@@ -65,7 +65,7 @@ func TestEthernetDisconnetConfig(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, testConfig := range testConfigs {
|
for _, testConfig := range testConfigs {
|
||||||
result, err := NewEthernetDisconnect(testConfig.testConfig)
|
result, err := CreateEthernetDisconnect(testConfig.testConfig)
|
||||||
|
|
||||||
if err != testConfig.expectedError {
|
if err != testConfig.expectedError {
|
||||||
t.Errorf("Error was incorrect, got: %s, want: %s.", err, testConfig.expectedError)
|
t.Errorf("Error was incorrect, got: %s, want: %s.", err, testConfig.expectedError)
|
||||||
|
|||||||
Reference in New Issue
Block a user