mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Use testing.TempDir() where possible
Refactor tests to use go built-in temporary directory utility for tests. Also avoid binding to default port (which may be in use)
This commit is contained in:
@@ -542,7 +542,6 @@ func TestClusterNameOption(t *testing.T) {
|
||||
listen: 127.0.0.1:-1
|
||||
}
|
||||
`))
|
||||
defer removeFile(t, conf)
|
||||
|
||||
s, opts := RunServerWithConfig(conf)
|
||||
defer s.Shutdown()
|
||||
@@ -563,7 +562,6 @@ func TestEphemeralClusterName(t *testing.T) {
|
||||
listen: 127.0.0.1:-1
|
||||
}
|
||||
`))
|
||||
defer removeFile(t, conf)
|
||||
|
||||
s, opts := RunServerWithConfig(conf)
|
||||
defer s.Shutdown()
|
||||
@@ -600,7 +598,6 @@ func TestClusterNameConflictsDropRoutes(t *testing.T) {
|
||||
listen: 127.0.0.1:5244
|
||||
}
|
||||
`))
|
||||
defer removeFile(t, conf)
|
||||
|
||||
s1, _ := RunServerWithConfig(conf)
|
||||
defer s1.Shutdown()
|
||||
@@ -614,7 +611,6 @@ func TestClusterNameConflictsDropRoutes(t *testing.T) {
|
||||
routes = [nats-route://127.0.0.1:5244]
|
||||
}
|
||||
`))
|
||||
defer removeFile(t, conf2)
|
||||
|
||||
s2, _ := RunServerWithConfig(conf2)
|
||||
defer s2.Shutdown()
|
||||
@@ -635,7 +631,6 @@ func TestClusterNameDynamicNegotiation(t *testing.T) {
|
||||
listen: 127.0.0.1:-1
|
||||
cluster {listen: 127.0.0.1:5244}
|
||||
`))
|
||||
defer removeFile(t, conf)
|
||||
|
||||
seed, _ := RunServerWithConfig(conf)
|
||||
defer seed.Shutdown()
|
||||
@@ -647,7 +642,6 @@ func TestClusterNameDynamicNegotiation(t *testing.T) {
|
||||
routes = [nats-route://127.0.0.1:5244]
|
||||
}
|
||||
`))
|
||||
defer removeFile(t, oconf)
|
||||
|
||||
// Create a random number of additional servers, up to 20.
|
||||
numServers := rand.Intn(20) + 1
|
||||
|
||||
Reference in New Issue
Block a user