Skip to content

Commit

Permalink
Merge pull request #3508 from Sajiyah-Salat/improve-hack-docs-sajiya
Browse files Browse the repository at this point in the history
🌱  Update destroy function
  • Loading branch information
k8s-ci-robot authored Jul 31, 2023
2 parents b020c34 + 91424ff commit c811b20
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/e2e/utils/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,12 @@ func (t *TestContext) Tidy() error {
// Destroy is for cleaning up the docker images for testing
func (t *TestContext) Destroy() {
//nolint:gosec
cmd := exec.Command("docker", "rmi", "-f", t.ImageName)
if _, err := t.Run(cmd); err != nil {
warnError(err)
// if image name is not present or not provided skip execution of docker command
if t.ImageName != "" {
cmd := exec.Command("docker", "rmi", "-f", t.ImageName)
if _, err := t.Run(cmd); err != nil {
warnError(err)
}
}
if err := os.RemoveAll(t.Dir); err != nil {
warnError(err)
Expand Down

0 comments on commit c811b20

Please sign in to comment.