Skip to content

Commit

Permalink
fix up test
Browse files Browse the repository at this point in the history
  • Loading branch information
chelseakomlo committed Dec 5, 2017
1 parent 723e47c commit c4e1dc3
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions client/driver/rkt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/hashicorp/nomad/client/config"
"github.com/hashicorp/nomad/nomad/structs"
"github.com/hashicorp/nomad/testutil"
"github.com/stretchr/testify/assert"

ctestutils "github.com/hashicorp/nomad/client/testutil"
)
Expand Down Expand Up @@ -334,6 +335,7 @@ func TestRktDriver_Start_Wait_AllocDir(t *testing.T) {
}

func TestRktDriverUser(t *testing.T) {
assert := assert.New(t)
if !testutil.IsTravis() {
t.Parallel()
}
Expand Down Expand Up @@ -366,18 +368,19 @@ func TestRktDriverUser(t *testing.T) {
defer ctx.AllocDir.Destroy()
d := NewRktDriver(ctx.DriverCtx)

if _, err := d.Prestart(ctx.ExecCtx, task); err != nil {
t.Fatalf("error in prestart: %v", err)
}
_, err := d.Prestart(ctx.ExecCtx, task)
assert.Nil(err)
resp, err := d.Start(ctx.ExecCtx, task)
if err == nil {
resp.Handle.Kill()
t.Fatalf("Should've failed")
}
msg := "unknown user alice"
if !strings.Contains(err.Error(), msg) {
t.Fatalf("Expecting '%v' in '%v'", msg, err)
assert.Nil(err)
defer resp.Handle.Kill()

select {
case res := <-resp.Handle.WaitCh():
assert.False(res.Successful())
case <-time.After(time.Duration(testutil.TestMultiplier()*15) * time.Second):
t.Fatalf("timeout")
}

}

func TestRktTrustPrefix(t *testing.T) {
Expand Down

0 comments on commit c4e1dc3

Please sign in to comment.