mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-09 10:47:35 +00:00
Merge pull request #38 from pmorie/wire-e2e-image
Fix wiring image built in CI to e2e test
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
@@ -23,20 +24,30 @@ func TestE2E(t *testing.T) {
|
||||
}
|
||||
|
||||
var (
|
||||
hubClient kubernetes.Interface
|
||||
hubDynamicClient dynamic.Interface
|
||||
clusterClient clusterv1client.Interface
|
||||
imageRegistry string
|
||||
hubClient kubernetes.Interface
|
||||
hubDynamicClient dynamic.Interface
|
||||
clusterClient clusterv1client.Interface
|
||||
registrationImage string
|
||||
)
|
||||
|
||||
// This suite is sensitive to the following environment variables:
|
||||
//
|
||||
// - IMAGE_NAME sets the exact image to deploy for the registration agent
|
||||
// - IMAGE_REGISTRY sets the image registry to use to build the IMAGE_NAME if
|
||||
// IMAGE_NAME is unset: IMAGE_REGISTRY/registration:latest
|
||||
// - KUBECONFIG is the location of the kubeconfig file to use
|
||||
var _ = ginkgo.BeforeSuite(func() {
|
||||
logf.SetLogger(zap.LoggerTo(ginkgo.GinkgoWriter, true))
|
||||
kubeconfig := os.Getenv("KUBECONFIG")
|
||||
imageRegistry = os.Getenv("IMAGE_REGISTRY")
|
||||
if imageRegistry == "" {
|
||||
imageRegistry = "quay.io/open-cluster-management"
|
||||
registrationImage = os.Getenv("IMAGE_NAME")
|
||||
if registrationImage == "" {
|
||||
imageRegistry := os.Getenv("IMAGE_REGISTRY")
|
||||
if imageRegistry == "" {
|
||||
imageRegistry = "quay.io/open-cluster-management"
|
||||
}
|
||||
registrationImage = fmt.Sprintf("%v/registration:latest", imageRegistry)
|
||||
}
|
||||
|
||||
kubeconfig := os.Getenv("KUBECONFIG")
|
||||
err := func() error {
|
||||
config, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
|
||||
if err != nil {
|
||||
|
||||
@@ -108,7 +108,7 @@ var _ = ginkgo.Describe("Loopback registration [development]", func() {
|
||||
}
|
||||
)
|
||||
clusterName := fmt.Sprintf("loopback-e2e-%v", suffix)
|
||||
deployment, err = spokeDeployment(nsName, clusterName, imageRegistry)
|
||||
deployment, err = spokeDeployment(nsName, clusterName, registrationImage)
|
||||
gomega.Expect(err).ToNot(gomega.HaveOccurred())
|
||||
err = wait.Poll(1*time.Second, 5*time.Second, func() (bool, error) {
|
||||
var err error
|
||||
@@ -303,7 +303,7 @@ func spokeCRB(nsName, suffix string) (*unstructured.Unstructured, error) {
|
||||
return crb, nil
|
||||
}
|
||||
|
||||
func spokeDeployment(nsName, clusterName, imageRegistry string) (*unstructured.Unstructured, error) {
|
||||
func spokeDeployment(nsName, clusterName, image string) (*unstructured.Unstructured, error) {
|
||||
deployment, err := assetToUnstructured("deploy/spoke/deployment.yaml")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -318,7 +318,6 @@ func spokeDeployment(nsName, clusterName, imageRegistry string) (*unstructured.U
|
||||
return nil, fmt.Errorf("deployment containers not found or error in spec: %v", err)
|
||||
}
|
||||
|
||||
image := fmt.Sprintf("%v/registration:latest", imageRegistry)
|
||||
if err := unstructured.SetNestedField(containers[0].(map[string]interface{}), image, "image"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user