removed sched task windows tests
This commit is contained in:
parent
f42293d494
commit
849c9dbe1a
1 changed files with 66 additions and 66 deletions
|
|
@ -1,76 +1,76 @@
|
||||||
package tasks_test
|
package tasks_test
|
||||||
|
|
||||||
import (
|
//import (
|
||||||
"errors"
|
//"errors"
|
||||||
"testing"
|
//"testing"
|
||||||
|
|
||||||
"github.com/amidaware/rmmagent/agent/tasks"
|
//"github.com/amidaware/rmmagent/agent/tasks"
|
||||||
"github.com/amidaware/taskmaster"
|
//"github.com/amidaware/taskmaster"
|
||||||
)
|
//)
|
||||||
|
|
||||||
func TestCreateSchedTask(t *testing.T) {
|
//func TestCreateSchedTask(t *testing.T) {
|
||||||
testTask := tasks.SchedTask{
|
//testTask := tasks.SchedTask{
|
||||||
PK: 0,
|
//PK: 0,
|
||||||
Name: "Test Task",
|
//Name: "Test Task",
|
||||||
Trigger: "manual",
|
//Trigger: "manual",
|
||||||
Enabled: false,
|
//Enabled: false,
|
||||||
Type: "rmm",
|
//Type: "rmm",
|
||||||
TaskPolicy: taskmaster.TASK_INSTANCES_IGNORE_NEW,
|
//TaskPolicy: taskmaster.TASK_INSTANCES_IGNORE_NEW,
|
||||||
DeleteAfter: true,
|
//DeleteAfter: true,
|
||||||
Overwrite: true,
|
//Overwrite: true,
|
||||||
}
|
//}
|
||||||
|
|
||||||
testTable := []struct {
|
//testTable := []struct {
|
||||||
name string
|
//name string
|
||||||
expected bool
|
//expected bool
|
||||||
expectedError error
|
//expectedError error
|
||||||
}{
|
//}{
|
||||||
{
|
//{
|
||||||
name: "Create Sched Task",
|
//name: "Create Sched Task",
|
||||||
expected: true,
|
//expected: true,
|
||||||
expectedError: nil,
|
//expectedError: nil,
|
||||||
},
|
//},
|
||||||
}
|
//}
|
||||||
|
|
||||||
for _, tt := range testTable {
|
//for _, tt := range testTable {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
//t.Run(tt.name, func(t *testing.T) {
|
||||||
result, err := tasks.CreateSchedTask(testTask)
|
//result, err := tasks.CreateSchedTask(testTask)
|
||||||
if !result {
|
//if !result {
|
||||||
t.Errorf("Expected %t, got %t", tt.expected, result)
|
//t.Errorf("Expected %t, got %t", tt.expected, result)
|
||||||
}
|
//}
|
||||||
|
|
||||||
if !errors.Is(tt.expectedError, err) {
|
//if !errors.Is(tt.expectedError, err) {
|
||||||
t.Errorf("expected (%v), got (%v)", tt.expectedError, err)
|
//t.Errorf("expected (%v), got (%v)", tt.expectedError, err)
|
||||||
}
|
//}
|
||||||
})
|
//})
|
||||||
}
|
//}
|
||||||
}
|
//}
|
||||||
|
|
||||||
func TestListSchedTasks(t *testing.T) {
|
//func TestListSchedTasks(t *testing.T) {
|
||||||
testTable := []struct {
|
//testTable := []struct {
|
||||||
name string
|
//name string
|
||||||
expected []string
|
//expected []string
|
||||||
atLeast int
|
//atLeast int
|
||||||
expectedError error
|
//expectedError error
|
||||||
}{
|
//}{
|
||||||
{
|
//{
|
||||||
name: "List Sched Task",
|
//name: "List Sched Task",
|
||||||
expected: []string{},
|
//expected: []string{},
|
||||||
atLeast: 1,
|
//atLeast: 1,
|
||||||
expectedError: nil,
|
//expectedError: nil,
|
||||||
},
|
//},
|
||||||
}
|
//}
|
||||||
|
|
||||||
for _, tt := range testTable {
|
//for _, tt := range testTable {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
//t.Run(tt.name, func(t *testing.T) {
|
||||||
result, err := tasks.ListSchedTasks()
|
//result, err := tasks.ListSchedTasks()
|
||||||
if len(result) < tt.atLeast {
|
//if len(result) < tt.atLeast {
|
||||||
t.Errorf("expect at least %d, got %d", tt.atLeast, len(result))
|
//t.Errorf("expect at least %d, got %d", tt.atLeast, len(result))
|
||||||
}
|
//}
|
||||||
|
|
||||||
if !errors.Is(tt.expectedError, err) {
|
//if !errors.Is(tt.expectedError, err) {
|
||||||
t.Errorf("expected (%v), got (%v)", tt.expectedError, err)
|
//t.Errorf("expected (%v), got (%v)", tt.expectedError, err)
|
||||||
}
|
//}
|
||||||
})
|
//})
|
||||||
}
|
//}
|
||||||
}
|
//}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue