Skip to content

Commit

Permalink
Update destroy func
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajiyah-Salat committed Jul 25, 2023
1 parent 0f390a9 commit 91424ff
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 @@ -232,9 +232,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 91424ff

Please sign in to comment.