MCPcopy
hub / github.com/operator-framework/operator-sdk / Run

Method Run

internal/scorecard/scorecard.go:73–116  ·  view source on GitHub ↗

Run executes the scorecard tests as configured

(ctx context.Context)

Source from the content-addressed store, hash-verified

71
72// Run executes the scorecard tests as configured
73func (o Scorecard) Run(ctx context.Context) (testOutput v1alpha3.TestList, err error) {
74 testOutput = v1alpha3.NewTestList()
75
76 if err := o.TestRunner.Initialize(ctx); err != nil {
77 return testOutput, err
78 }
79
80 for _, stage := range o.Config.Stages {
81 tests := o.selectTests(stage)
82 if len(tests) == 0 {
83 continue
84 }
85 tests = o.setTestDefaults(tests)
86
87 output := make(chan v1alpha3.Test, len(tests))
88 if stage.Parallel {
89 o.runStageParallel(ctx, tests, output)
90 } else {
91 o.runStageSequential(ctx, tests, output)
92 }
93 close(output)
94 for o := range output {
95 testOutput.Items = append(testOutput.Items, o)
96 }
97 }
98
99 // Get timeout error, if any, before calling Cleanup() so deletes don't cause a timeout.
100 select {
101 case <-ctx.Done():
102 err = ctx.Err()
103 default:
104 }
105
106 if !o.SkipCleanup {
107 // Use a separate context for cleanup, which needs to run regardless of a prior timeout.
108 clctx, cancel := context.WithTimeout(context.Background(), cleanupTimeout)
109 defer cancel()
110 if err := o.TestRunner.Cleanup(clctx); err != nil {
111 return testOutput, err
112 }
113 }
114
115 return testOutput, err
116}
117
118func (o Scorecard) setTestDefaults(tests []v1alpha3.TestConfiguration) []v1alpha3.TestConfiguration {
119 for i := range tests {

Callers 15

runMethod · 0.95
TestRunFunction · 0.95
e2e_test.goFile · 0.45
curlMetricsFunction · 0.45
serviceAccountTokenFunction · 0.45
e2e_test.goFile · 0.45
TestChangelog_TemplateFunction · 0.45
TestChangelog_WriteFileFunction · 0.45
TestFragment_LoadEntriesFunction · 0.45

Calls 7

selectTestsMethod · 0.95
setTestDefaultsMethod · 0.95
runStageParallelMethod · 0.95
runStageSequentialMethod · 0.95
ErrMethod · 0.80
InitializeMethod · 0.65
CleanupMethod · 0.65