-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-10329] Fail fast when required image missing
The integration tests expect ccenv and third party docker images have been pulled before the tests start. When any of these images are missing, fail the tests quickly with a clear message. Change-Id: If183a531c7fcee01e01191b04ccfc746dd19ffbc Signed-off-by: Matthew Sykes <[email protected]>
- Loading branch information
Showing
3 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
Copyright IBM Corp All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package helpers | ||
|
||
import ( | ||
"fmt" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
|
||
docker "github.com/fsouza/go-dockerclient" | ||
) | ||
|
||
func AssertImagesExist(imageNames ...string) { | ||
dockerClient, err := docker.NewClientFromEnv() | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
for _, imageName := range imageNames { | ||
images, err := dockerClient.ListImages(docker.ListImagesOptions{ | ||
Filter: imageName, | ||
}) | ||
ExpectWithOffset(1, err).NotTo(HaveOccurred()) | ||
|
||
if len(images) != 1 { | ||
Fail(fmt.Sprintf("missing required image: %s", imageName), 1) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters