diff --git a/job_test.go b/job_test.go index bb3210e..65bad3f 100644 --- a/job_test.go +++ b/job_test.go @@ -174,7 +174,7 @@ func TestJobTaskScript(t *testing.T) { } } -func TestJobTaskMySQL(t *testing.T) { +func TestJobTaskSql(t *testing.T) { t.Parallel() type TaskGenerator interface { diff --git a/restic_test.go b/restic_test.go index 2eae8d7..5549677 100644 --- a/restic_test.go +++ b/restic_test.go @@ -6,9 +6,17 @@ import ( "time" main "git.iamthefij.com/iamthefij/restic-scheduler" - "github.com/go-test/deep" ) +func TestNoOpts(t *testing.T) { + t.Parallel() + + args := main.NoOpts{}.ToArgs() + expected := []string{} + + AssertEqual(t, "no opts returned some opts", expected, args) +} + func TestGlobalOptions(t *testing.T) { t.Parallel() @@ -38,9 +46,7 @@ func TestGlobalOptions(t *testing.T) { "--no-lock", } - if diff := deep.Equal(args, expected); diff != nil { - t.Errorf("args didn't match %v", diff) - } + AssertEqual(t, "args didn't match", expected, args) } func TestBackupOpts(t *testing.T) { @@ -61,9 +67,7 @@ func TestBackupOpts(t *testing.T) { "--host", "steve", } - if diff := deep.Equal(args, expected); diff != nil { - t.Errorf("args didn't match %v", diff) - } + AssertEqual(t, "args didn't match", expected, args) } func TestRestoreOpts(t *testing.T) { @@ -90,9 +94,7 @@ func TestRestoreOpts(t *testing.T) { "--verify", } - if diff := deep.Equal(args, expected); diff != nil { - t.Errorf("args didn't match %v", diff) - } + AssertEqual(t, "args didn't match", expected, args) } func TestForgetOpts(t *testing.T) { @@ -138,9 +140,7 @@ func TestForgetOpts(t *testing.T) { "--prune", } - if diff := deep.Equal(args, expected); diff != nil { - t.Errorf("args didn't match %v", diff) - } + AssertEqual(t, "args didn't match", expected, args) } func TestBuildEnv(t *testing.T) { @@ -178,9 +178,7 @@ func TestBuildEnv(t *testing.T) { t.Run(c.name, func(t *testing.T) { t.Parallel() - if diff := deep.Equal(c.expected, c.cmd.BuildEnv()); diff != nil { - t.Error(diff) - } + AssertEqual(t, "args didn't match", c.expected, c.cmd.BuildEnv()) }) } } diff --git a/utils_test.go b/utils_test.go index 0fc0895..5122dc3 100644 --- a/utils_test.go +++ b/utils_test.go @@ -10,8 +10,8 @@ import ( func AssertEqual(t *testing.T, message string, expected, actual interface{}) bool { t.Helper() - if expected != actual { - t.Errorf("%s. expected: %v, actual: %v", message, expected, actual) + if diff := deep.Equal(expected, actual); diff != nil { + t.Errorf("%s: %v", message, diff) } return true