Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
HeavyHorst committed Nov 8, 2016
1 parent 7acb32c commit 1e75163
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ log_level = "debug"
log_format = "text"
[[resource]]
[[resource.template]]
src = "test12345"
dst = "test12345"
src = "/tmp/test12345.tmpl"
dst = "/tmp/test12345.cfg"
checkCmd = ""
reloadCmd = ""
mode = "0644"
Expand All @@ -42,8 +42,8 @@ log_format = "text"

var expectedTemplates = []*template.ProcessConfig{
&template.ProcessConfig{
Src: "test12345",
Dst: "test12345",
Src: "/tmp/test12345.tmpl",
Dst: "/tmp/test12345.cfg",
Mode: "0644",
},
}
Expand Down Expand Up @@ -80,16 +80,28 @@ type FilterSuite struct {
var _ = Suite(&FilterSuite{})

func (s *FilterSuite) SetUpSuite(t *C) {
f, err := ioutil.TempFile("/tmp", "")
// write cfg and tmpl file
f, err := os.Create("/tmp/test12345.tmpl")
if err != nil {
t.Error(err)
}
defer f.Close()
_, err = f.WriteString(testFile)
f2, err := os.Create("/tmp/test12345.cfg")
if err != nil {
t.Error(err)
}
s.cfgPath = f.Name()
defer f2.Close()

f3, err := ioutil.TempFile("/tmp", "")
if err != nil {
t.Error(err)
}
defer f3.Close()
_, err = f3.WriteString(testFile)
if err != nil {
t.Error(err)
}
s.cfgPath = f3.Name()
}

func (s *FilterSuite) TearDownSuite(t *C) {
Expand Down

0 comments on commit 1e75163

Please sign in to comment.