Skip to content

Commit 59368bf

Browse files
committed
Add e2e test setup
Signed-off-by: Per G. da Silva <[email protected]>
1 parent 2e25928 commit 59368bf

File tree

3 files changed

+225
-2258
lines changed

3 files changed

+225
-2258
lines changed

pkg/controller/registry/resolver/resolver.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ type SatResolver struct {
3939
}
4040

4141
func NewDefaultSatResolver(rcp cache.SourceProvider, catsrcLister v1alpha1listers.CatalogSourceLister, logger logrus.FieldLogger) *SatResolver {
42-
43-
runtimeConstraintProvider, err := runtime_constraints.NewFromFile(runtimeConstraintsFilePath)
42+
runtimeConstraintProvider, err := runtime_constraints.NewFromEnv()
4443
if err != nil {
4544
if errors.Is(err, os.ErrNotExist) {
4645
logger.Warning("No cluster runtime constraints file found. Proceeding without...")

pkg/controller/registry/resolver/runtime_constraints/provider.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package runtime_constraints
33
import (
44
"encoding/json"
55
"io/ioutil"
6+
"os"
67

78
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver/cache"
89
"github.com/operator-framework/operator-registry/pkg/registry"
@@ -11,6 +12,7 @@ import (
1112

1213
const (
1314
maxRuntimeConstraints = 10
15+
RuntimeConstraintEnvVarName = "RUNTIME_CONSTRAINTS_FILE_PATH"
1416
)
1517

1618
type RuntimeConstraintsProvider struct {
@@ -27,6 +29,14 @@ func New(runtimeConstraints []cache.Predicate) *RuntimeConstraintsProvider {
2729
}
2830
}
2931

32+
func NewFromEnv() (*RuntimeConstraintsProvider, error) {
33+
runtimeConstraintsFilePath, isSet := os.LookupEnv(RuntimeConstraintEnvVarName)
34+
if !isSet {
35+
return nil, nil
36+
}
37+
return NewFromFile(runtimeConstraintsFilePath)
38+
}
39+
3040
func NewFromFile(runtimeConstraintsFilePath string) (*RuntimeConstraintsProvider, error) {
3141
propertiesFile, err := readRuntimeConstraintsYaml(runtimeConstraintsFilePath)
3242
if err != nil {

0 commit comments

Comments
 (0)