Merge pull request #1996 from hashicorp/t-failing-tests
Fix some failing tests
This commit is contained in:
commit
c2697123a9
|
@ -445,13 +445,19 @@ func TestRktDriver_PortsMapping(t *testing.T) {
|
|||
if handle == nil {
|
||||
t.Fatalf("missing handle")
|
||||
}
|
||||
defer handle.Kill()
|
||||
|
||||
failCh := make(chan error, 1)
|
||||
go func() {
|
||||
time.Sleep(1 * time.Second)
|
||||
if err := handle.Kill(); err != nil {
|
||||
failCh <- err
|
||||
}
|
||||
}()
|
||||
|
||||
select {
|
||||
case res := <-handle.WaitCh():
|
||||
if !res.Successful() {
|
||||
t.Fatalf("err: %v", res)
|
||||
}
|
||||
case err := <-failCh:
|
||||
t.Fatalf("failed to kill handle: %v", err)
|
||||
case <-handle.WaitCh():
|
||||
case <-time.After(time.Duration(testutil.TestMultiplier()*15) * time.Second):
|
||||
t.Fatalf("timeout")
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ func (a *Agent) clientConfig() (*clientconfig.Config, error) {
|
|||
if a.config.Client.MaxKillTimeout != "" {
|
||||
dur, err := time.ParseDuration(a.config.Client.MaxKillTimeout)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error parsing retry interval: %s", err)
|
||||
return nil, fmt.Errorf("Error parsing max kill timeout: %s", err)
|
||||
}
|
||||
conf.MaxKillTimeout = dur
|
||||
}
|
||||
|
|
|
@ -43,6 +43,10 @@ func makeAgent(t testing.TB, cb func(*Config)) (string, *Agent) {
|
|||
config := nomad.DefaultConfig()
|
||||
conf.NomadConfig = config
|
||||
|
||||
// Set the data_dir
|
||||
conf.DataDir = dir
|
||||
conf.NomadConfig.DataDir = dir
|
||||
|
||||
// Bind and set ports
|
||||
conf.BindAddr = "127.0.0.1"
|
||||
conf.Ports = &Ports{
|
||||
|
|
|
@ -80,12 +80,6 @@ func TestRetryJoin(t *testing.T) {
|
|||
defer os.RemoveAll(dir)
|
||||
defer agent.Shutdown()
|
||||
|
||||
tmpDir, err := ioutil.TempDir("", "nomad")
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
doneCh := make(chan struct{})
|
||||
shutdownCh := make(chan struct{})
|
||||
|
||||
|
@ -96,7 +90,11 @@ func TestRetryJoin(t *testing.T) {
|
|||
|
||||
cmd := &Command{
|
||||
ShutdownCh: shutdownCh,
|
||||
Ui: new(cli.MockUi),
|
||||
Ui: &cli.BasicUi{
|
||||
Reader: os.Stdin,
|
||||
Writer: os.Stdout,
|
||||
ErrorWriter: os.Stderr,
|
||||
},
|
||||
}
|
||||
|
||||
serfAddr := fmt.Sprintf(
|
||||
|
@ -105,8 +103,7 @@ func TestRetryJoin(t *testing.T) {
|
|||
agent.config.Ports.Serf)
|
||||
|
||||
args := []string{
|
||||
"-server",
|
||||
"-data-dir", tmpDir,
|
||||
"-dev",
|
||||
"-node", fmt.Sprintf(`"Node %d"`, getPort()),
|
||||
"-retry-join", serfAddr,
|
||||
"-retry-interval", "1s",
|
||||
|
|
Loading…
Reference in a new issue