Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"os"
"os/exec"
"runtime"
"strings"
"testing"

. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -94,6 +95,14 @@ var _ = BeforeSuite(func() {
if output, err := cmd.CombinedOutput(); err != nil {
ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to pull apiserver image: %s", string(output))
}
platformTag := fmt.Sprintf("%s-%s", apiserverImage, apiserverArch)
imageID, err := dockerImageID(apiserverImage)
ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to read apiserver image ID")
cmd = exec.Command("docker", "tag", imageID, platformTag)
if output, err := cmd.CombinedOutput(); err != nil {
ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to tag apiserver image: %s", string(output))
}
apiserverImage = platformTag
}

By("loading the apiserver image on Kind")
Expand Down Expand Up @@ -132,6 +141,15 @@ func isLocalImagePresent(image string) bool {
return cmd.Run() == nil
}

func dockerImageID(image string) (string, error) {
cmd := exec.Command("docker", "image", "inspect", "--format", "{{.Id}}", image)
output, err := cmd.CombinedOutput()
if err != nil {
return "", err
}
return strings.TrimSpace(string(output)), nil
}

var _ = AfterSuite(func() {
// Teardown CertManager after the suite if not skipped and if it was not already installed
if !skipCertManagerInstall && !isCertManagerAlreadyInstalled {
Expand Down
Loading