mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Flakes in integration/clientv3/examples/...
The tests sometimes flaked due to already existing socket-files. Now each execution works in a tempoarary directory.
This commit is contained in:
parent
3b589fb3b2
commit
8cd8a1ea10
@ -15,6 +15,7 @@
|
||||
package clientv3_test
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
@ -44,6 +45,16 @@ func forUnitTestsRunInMockedContext(mocking func(), example func()) {
|
||||
// TestMain sets up an etcd cluster if running the examples.
|
||||
func TestMain(m *testing.M) {
|
||||
testutil.ExitInShortMode("Skipping: the tests require real cluster")
|
||||
|
||||
tempDir := os.TempDir()
|
||||
defer os.RemoveAll(tempDir)
|
||||
|
||||
err := os.Chdir(tempDir)
|
||||
if err != nil {
|
||||
log.Printf("Failed to change working dir to: %s: %v", tempDir, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
v := m.Run()
|
||||
lazyCluster.Terminate()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user