mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
added flag for persisting tmp with tests
This commit is contained in:
parent
d05667ace1
commit
0584035f6c
1 changed files with 8 additions and 2 deletions
|
@ -21,6 +21,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var logging = flag.Bool("logging", false, "set to true to enable the normal logger of the package")
|
var logging = flag.Bool("logging", false, "set to true to enable the normal logger of the package")
|
||||||
|
var persistTmp = flag.Bool("persistTmp", false, "set to true to persist the tmp folder")
|
||||||
|
|
||||||
func newServerForTesting(t *testing.T, addressAndPort string, testFolder string) (*server, *Configuration) {
|
func newServerForTesting(t *testing.T, addressAndPort string, testFolder string) (*server, *Configuration) {
|
||||||
if !*logging {
|
if !*logging {
|
||||||
|
@ -120,8 +121,13 @@ func TestRequest(t *testing.T) {
|
||||||
}
|
}
|
||||||
defer ns.Shutdown()
|
defer ns.Shutdown()
|
||||||
|
|
||||||
// tempdir := t.TempDir()
|
var tempDir string
|
||||||
tempDir := "tmp"
|
if *persistTmp {
|
||||||
|
tempDir = "tmp"
|
||||||
|
} else {
|
||||||
|
tempDir = t.TempDir()
|
||||||
|
}
|
||||||
|
|
||||||
srv, conf := newServerForTesting(t, "127.0.0.1:42222", tempDir)
|
srv, conf := newServerForTesting(t, "127.0.0.1:42222", tempDir)
|
||||||
srv.Start()
|
srv.Start()
|
||||||
defer srv.Stop()
|
defer srv.Stop()
|
||||||
|
|
Loading…
Reference in a new issue