New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rkt: fix panic on rm a non-existing pod with uuid-file #2679

Merged
merged 2 commits into from May 24, 2016
Jump to file or symbol
Failed to load files and symbols.
+21 −0
Diff settings

Always

Just for now

Viewing a subset of changes. View all
Prev

functional tests: add tests for rkt rm

  • Loading branch information...
iaguis committed May 24, 2016
commit 4c9e24ea62d1685a2e1124cef9e4cac84cec23fa
Copy path View file
@@ -79,3 +79,24 @@ func TestRm(t *testing.T) {
}
}
}
func TestRmInvalid(t *testing.T) {
ctx := testutils.NewRktRunCtx()
defer ctx.Cleanup()
nonexistentUUID := "0f746094-3438-42bc-ab37-3cf85f132e60"
tmpDir := createTempDirOrPanic("rkt_rm_test")
defer os.RemoveAll(tmpDir)
uuidFile := filepath.Join(tmpDir, "uuid-file")
if err := ioutil.WriteFile(uuidFile, []byte(nonexistentUUID), 0600); err != nil {
t.Fatalf("cannot write uuid-file: %v", err)
}
expected := fmt.Sprintf("no matches found for %q", nonexistentUUID)
cmd := fmt.Sprintf("%s rm %s", ctx.Cmd(), nonexistentUUID)
runRktAndCheckOutput(t, cmd, expected, true)
cmd = fmt.Sprintf("%s rm --uuid-file=%s", ctx.Cmd(), uuidFile)
runRktAndCheckOutput(t, cmd, expected, true)
}
ProTip! Use n and p to navigate between commits in a pull request.