Skip to content

Commit 7a5bb22

Browse files
jeyaramashokEric Stroczynski
authored andcommitted
scorecard: Fix basic tests run when 'olm-deployed: true' (#2274)
* read CSV when config.OLMDeployed is enabled * filter listing pods based on deployment's namespace Fixes #2271
1 parent 7dab655 commit 7a5bb22

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
### Bug Fixes
2424
- Fix issue faced in the Ansible based operators when `jmespath` queries are used because it was not installed. ([#2252](https://github.com/operator-framework/operator-sdk/pull/2252))
25+
- Fix scorecard behavior such that a CSV file is read correctly when `olm-deployed` is set to `true`. ([#2274](https://github.com/operator-framework/operator-sdk/pull/2274))
2526

2627
## v0.12.0
2728

internal/scorecard/plugins/plugin_runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func RunInternalPlugin(pluginType PluginType, config BasicAndOLMPluginConfig, lo
125125
runtimeClient, _ = client.New(kubeconfig, client.Options{Scheme: scheme, Mapper: restMapper})
126126

127127
csv := &olmapiv1alpha1.ClusterServiceVersion{}
128-
if pluginType == OLMIntegration {
128+
if pluginType == OLMIntegration || config.OLMDeployed {
129129
yamlSpec, err := ioutil.ReadFile(config.CSVManifest)
130130
if err != nil {
131131
return scapiv1alpha1.ScorecardOutput{}, fmt.Errorf("failed to read csv: %v", err)

internal/scorecard/plugins/resource_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func getPodFromDeployment(depName, namespace string) (pod *v1.Pod, err error) {
174174
// instead of the new one.
175175
err = wait.PollImmediate(time.Second*1, time.Second*60, func() (bool, error) {
176176
pods := &v1.PodList{}
177-
err = runtimeClient.List(context.TODO(), pods, client.MatchingLabels(dep.Spec.Selector.MatchLabels))
177+
err = runtimeClient.List(context.TODO(), pods, client.InNamespace(namespace), client.MatchingLabels(dep.Spec.Selector.MatchLabels))
178178
if err != nil {
179179
return false, fmt.Errorf("failed to get list of pods in deployment: %v", err)
180180
}

0 commit comments

Comments
 (0)