TestOrchestratorCallsRenderConfig verifies that setupEngineAndImports invokes RenderConfig and stores the returned steps in engineSetupResult.configSteps.
(t *testing.T)
| 130 | // TestOrchestratorCallsRenderConfig verifies that setupEngineAndImports invokes |
| 131 | // RenderConfig and stores the returned steps in engineSetupResult.configSteps. |
| 132 | func TestOrchestratorCallsRenderConfig(t *testing.T) { |
| 133 | const sentinelStepName = "sentinel-config-step" |
| 134 | |
| 135 | configSteps := []map[string]any{ |
| 136 | {"name": sentinelStepName, "run": "echo sentinel"}, |
| 137 | } |
| 138 | testEngine := newConfigRenderingEngine(configSteps) |
| 139 | |
| 140 | // Build a compiler whose registry contains the test engine. |
| 141 | registry := NewEngineRegistry() |
| 142 | require.NoError(t, registry.Register(testEngine), "test engine should register without error") |
| 143 | catalog := NewEngineCatalog(registry) |
| 144 | |
| 145 | compiler := NewCompiler() |
| 146 | compiler.engineRegistry = registry |
| 147 | compiler.engineCatalog = catalog |
| 148 | |
| 149 | // Resolve the test engine to simulate what setupEngineAndImports does. |
| 150 | engineConfig := &EngineConfig{ID: testEngine.GetID()} |
| 151 | resolved, err := catalog.Resolve(testEngine.GetID(), engineConfig) |
| 152 | require.NoError(t, err, "test engine should resolve without error") |
| 153 | |
| 154 | // Call RenderConfig directly via the resolved runtime to verify the hook. |
| 155 | steps, err := resolved.Runtime.RenderConfig(resolved) |
| 156 | require.NoError(t, err, "RenderConfig should not error") |
| 157 | require.Len(t, steps, 1, "should return exactly one config step") |
| 158 | assert.Equal(t, sentinelStepName, steps[0]["name"], |
| 159 | "config step name should match sentinel value") |
| 160 | } |
nothing calls this directly
no test coverage detected