Skip to content

Commit

Permalink
server: rm the server test's data dir only! (close #24)
Browse files Browse the repository at this point in the history
  • Loading branch information
travisjeffery committed Feb 10, 2017
1 parent b2996a6 commit fa68ab6
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,13 @@ import (
"github.com/travisjeffery/simplelog"
)

var (
dataDir string
)

const (
topic = "test_topic"
messageCount = 15
clientID = "test_client"
numPartitions = int32(1)
)

func init() {
dataDir, _ = ioutil.TempDir("", "server_test")
}

func TestBroker(t *testing.T) {
conn, teardown := setup(t)

Expand Down Expand Up @@ -186,9 +178,8 @@ func TestBroker(t *testing.T) {
}

func setup(t *testing.T) (*net.TCPConn, func()) {
dir := os.TempDir()

assert.NoError(t, os.MkdirAll(dataDir, 0755))
dataDir, err := ioutil.TempDir("", "server_test")
assert.NoError(t, err)

logger := simplelog.New(os.Stdout, simplelog.DEBUG, "jocko/servertest")
store, err := broker.New(0,
Expand Down Expand Up @@ -219,7 +210,7 @@ func setup(t *testing.T) (*net.TCPConn, func()) {
conn.Close()
srv.Close()
store.Shutdown()
os.RemoveAll(dir)
os.RemoveAll(dataDir)
}
}
func createTopic(t *testing.T, conn *net.TCPConn) {
Expand Down

0 comments on commit fa68ab6

Please sign in to comment.