spongy/spongyd/spongy_test.go

32 lines
571 B
Go
Raw Normal View History

2015-02-11 15:01:14 -07:00
package main
import (
2015-02-11 15:54:23 -07:00
"io/ioutil"
2015-02-11 15:01:14 -07:00
"os"
"path"
"testing"
)
2015-02-11 15:54:23 -07:00
func setupRunSpongy(t *testing.T, parent string, baseChan chan<- string) {
base, _ := createNetwork(t, parent)
2015-02-11 15:01:14 -07:00
baseChan <- base
close(baseChan)
2015-02-11 15:54:23 -07:00
runsvdir(parent)
2015-02-11 15:01:14 -07:00
os.RemoveAll(base)
}
func TestRunsvdir(t *testing.T) {
2015-02-11 15:54:23 -07:00
parent, err := ioutil.TempDir("", "spongy-test")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(parent)
2015-02-11 15:01:14 -07:00
baseChan := make(chan string)
2015-02-11 15:54:23 -07:00
go setupRunSpongy(t, parent, baseChan)
2015-02-11 15:01:14 -07:00
base := <- baseChan
expect(t, path.Join(base, "log", "current"), " 001 ")
os.RemoveAll(base)
}