Skip to content

Commit

Permalink
Add tests, ISSUE-952
Browse files Browse the repository at this point in the history
  • Loading branch information
abador committed May 25, 2022
1 parent 7650084 commit db4c862
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cmd/cleanup/sql_test.go
@@ -0,0 +1,24 @@
package cleanup

import (
"bytes"
"io/ioutil"
"strings"
"testing"
)

func Test_ExecuteCleanupFailedDSN(t *testing.T) {
cmd := NewCleanupSQLCmd()
b := bytes.NewBufferString("")
cmd.SetOut(b)
cmd.SetArgs([]string{"--read-from-env=false"})
cmd.Execute()
out, err := ioutil.ReadAll(b)
if err != nil {
t.Fatal(err)
}
if !strings.Contains(string(out), "expected to get the DSN as an argument") {
t.Fatalf("expected \"%s\" got \"%s\"", "expected to get the DSN as an argument", string(out))
}
cmd.Execute()
}

0 comments on commit db4c862

Please sign in to comment.