Skip to content

Commit

Permalink
e2e: support env var for catalog image (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncdc committed Jul 5, 2023
1 parent b996f69 commit c691c3e
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions test/e2e/unpack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"os"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand All @@ -17,15 +18,25 @@ import (
)

const (
catalogRef = "localhost/testdata/catalogs/test-catalog:e2e"
catalogName = "test-catalog"
pkg = "prometheus"
version = "0.47.0"
channel = "beta"
bundle = "prometheus-operator.0.47.0"
bundleImage = "localhost/testdata/bundles/registry-v1/prometheus-operator:v0.47.0"
catalogRefEnvVar = "TEST_CATALOG_IMAGE"
catalogName = "test-catalog"
pkg = "prometheus"
version = "0.47.0"
channel = "beta"
bundle = "prometheus-operator.0.47.0"
bundleImage = "localhost/testdata/bundles/registry-v1/prometheus-operator:v0.47.0"
)

// catalogImageRef returns the image reference for the test catalog image, defaulting to the value of the environment
// variable TEST_CATALOG_IMAGE if set, falling back to localhost/testdata/catalogs/test-catalog:e2e otherwise.
func catalogImageRef() string {
if s := os.Getenv(catalogRefEnvVar); s != "" {
return s
}

return "localhost/testdata/catalogs/test-catalog:e2e"
}

var _ = Describe("Catalog Unpacking", func() {
var (
ctx context.Context
Expand All @@ -35,6 +46,7 @@ var _ = Describe("Catalog Unpacking", func() {
BeforeEach(func() {
ctx = context.Background()
var err error

catalog = &catalogd.Catalog{
ObjectMeta: metav1.ObjectMeta{
Name: catalogName,
Expand All @@ -43,7 +55,7 @@ var _ = Describe("Catalog Unpacking", func() {
Source: catalogd.CatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ImageSource{
Ref: catalogRef,
Ref: catalogImageRef(),
},
},
},
Expand Down

0 comments on commit c691c3e

Please sign in to comment.