@@ -116,6 +116,86 @@ func TestEvaluationOrchestrator_AddEvaluationSuite(t *testing.T) {
116116 })
117117}
118118
119+ func TestEvaluationOrchestrator_AddEvaluationSuiteForAllCatalogs (t * testing.T ) {
120+ t .Run ("Error Without Reference Catalogs" , func (t * testing.T ) {
121+ orchestrator := & EvaluationOrchestrator {}
122+ steps := map [string ][]gemara.AssessmentStep {
123+ "test-requirement" : {step_Pass },
124+ }
125+
126+ err := orchestrator .AddEvaluationSuiteForAllCatalogs (nil , steps )
127+ if err == nil {
128+ t .Error ("Expected error when no reference catalogs are loaded" )
129+ }
130+ if ! strings .Contains (err .Error (), "no reference catalogs loaded" ) {
131+ t .Errorf ("Expected 'no reference catalogs loaded' error, got: %v" , err )
132+ }
133+ })
134+
135+ t .Run ("Registers Suite For Each Catalog" , func (t * testing.T ) {
136+ orchestrator := & EvaluationOrchestrator {}
137+ catalog1 := getTestCatalogWithID ("CCC.ObjStor" )
138+ catalog2 := getTestCatalogWithID ("CCC.ObjStor-v2" )
139+ orchestrator .referenceCatalogs = map [string ]* gemara.ControlCatalog {
140+ catalog1 .Metadata .Id : catalog1 ,
141+ catalog2 .Metadata .Id : catalog2 ,
142+ }
143+
144+ steps := map [string ][]gemara.AssessmentStep {
145+ "CCC.Core.C01.TR01" : {step_Pass },
146+ }
147+
148+ err := orchestrator .AddEvaluationSuiteForAllCatalogs (nil , steps )
149+ if err != nil {
150+ t .Fatalf ("Unexpected error: %v" , err )
151+ }
152+
153+ if len (orchestrator .possibleSuites ) != 2 {
154+ t .Errorf ("Expected 2 suites (one per catalog), got %d" ,
155+ len (orchestrator .possibleSuites ))
156+ }
157+
158+ // Verify each catalog got its own suite
159+ suiteIDs := make (map [string ]bool )
160+ for _ , suite := range orchestrator .possibleSuites {
161+ suiteIDs [suite .CatalogId ] = true
162+ }
163+ if ! suiteIDs ["CCC.ObjStor" ] || ! suiteIDs ["CCC.ObjStor-v2" ] {
164+ t .Errorf ("Expected suites for both catalogs, got: %v" , suiteIDs )
165+ }
166+ })
167+
168+ t .Run ("Uses Provided Loader" , func (t * testing.T ) {
169+ orchestrator := & EvaluationOrchestrator {}
170+ catalog := getTestCatalogWithRequirements ()
171+ orchestrator .referenceCatalogs = map [string ]* gemara.ControlCatalog {
172+ catalog .Metadata .Id : catalog ,
173+ }
174+
175+ testLoader := func (cfg * config.Config ) (interface {}, error ) {
176+ return "suite-specific-payload" , nil
177+ }
178+ steps := map [string ][]gemara.AssessmentStep {
179+ "CCC.Core.C01.TR01" : {step_Pass },
180+ }
181+
182+ err := orchestrator .AddEvaluationSuiteForAllCatalogs (testLoader , steps )
183+ if err != nil {
184+ t .Fatalf ("Unexpected error: %v" , err )
185+ }
186+
187+ if len (orchestrator .possibleSuites ) != 1 {
188+ t .Errorf ("Expected 1 suite for single catalog, got %d" , len (orchestrator .possibleSuites ))
189+ }
190+
191+ for _ , suite := range orchestrator .possibleSuites {
192+ if suite .loader == nil {
193+ t .Error ("Expected suite loader to be set" )
194+ }
195+ }
196+ })
197+ }
198+
119199func TestEvaluationOrchestrator_Integration (t * testing.T ) {
120200 t .Run ("Basic Setup" , func (t * testing.T ) {
121201 orchestrator := & EvaluationOrchestrator {
0 commit comments