tests
This commit is contained in:
parent
4e656c6556
commit
91c9de6e34
5 changed files with 155 additions and 42 deletions
37
agent/wmi/wmi_windows_test.go
Normal file
37
agent/wmi/wmi_windows_test.go
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package wmi_test
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/amidaware/rmmagent/agent/wmi"
|
||||
)
|
||||
|
||||
func TestGetWMIInfo(t *testing.T) {
|
||||
testTable := []struct {
|
||||
name string
|
||||
expected map[string]interface{}
|
||||
atLeast int
|
||||
expectedErrors []error
|
||||
}{
|
||||
{
|
||||
name: "Get WMI Data",
|
||||
expected: make(map[string]interface{}),
|
||||
atLeast: 1,
|
||||
expectedErrors: []error{},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range testTable {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
result, errs := wmi.GetWMIInfo()
|
||||
if len(result) < tt.atLeast {
|
||||
t.Errorf("expected at least %d, got %d", tt.atLeast, len(result))
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(errs, tt.expectedErrors) {
|
||||
t.Errorf("expected errors (%v), got (%v)", tt.expectedErrors, errs)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue