@@ -215,14 +215,7 @@ func (suite *ResolverTestSuite) TestResolveOptions_ExpiredCache() {
215215}
216216
217217func (suite * ResolverTestSuite ) TestResolveOptions_PreserveChildWhenParentUnchanged () {
218- suite .resolver .graph = graph .NewGraph [* types.Option ]()
219-
220- parentOption := & types.Option {Description : "Parent" , Default : "new_parent_value" }
221- childOption := & types.Option {Description : "Child" , Default : "child_default" }
222-
223- suite .Require ().NoError (suite .resolver .graph .AddNode ("parent" , parentOption ))
224- suite .Require ().NoError (suite .resolver .graph .AddNode ("child" , childOption ))
225- suite .Require ().NoError (suite .resolver .graph .AddEdge ("parent" , "child" ))
218+ suite .setupParentChildGraph ()
226219
227220 existingValues := map [string ]config.OptionValue {
228221 "parent" : {Value : "old_parent_value" , UserProvided : true },
@@ -237,14 +230,7 @@ func (suite *ResolverTestSuite) TestResolveOptions_PreserveChildWhenParentUnchan
237230}
238231
239232func (suite * ResolverTestSuite ) TestResolveOptions_PreserveUserProvidedChild () {
240- suite .resolver .graph = graph .NewGraph [* types.Option ]()
241-
242- parentOption := & types.Option {Description : "Parent" , Default : "new_parent_value" }
243- childOption := & types.Option {Description : "Child" , Default : "child_default" }
244-
245- suite .Require ().NoError (suite .resolver .graph .AddNode ("parent" , parentOption ))
246- suite .Require ().NoError (suite .resolver .graph .AddNode ("child" , childOption ))
247- suite .Require ().NoError (suite .resolver .graph .AddEdge ("parent" , "child" ))
233+ suite .setupParentChildGraph ()
248234
249235 existingValues := map [string ]config.OptionValue {
250236 "parent" : {Value : "old_parent_value" , UserProvided : true },
@@ -321,3 +307,17 @@ func (suite *ResolverTestSuite) TestAddOptionsToGraph_MultipleCalls() {
321307 nodes := g .GetNodes ()
322308 suite .Len (nodes , 2 , "Multiple calls to addOptionsToGraph should not duplicate nodes." )
323309}
310+
311+ // setupParentChildGraph creates a resolver graph with a "parent" option that
312+ // has a "child" option depending on it, used by tests that verify
313+ // user-provided-value precedence during resolution.
314+ func (suite * ResolverTestSuite ) setupParentChildGraph () {
315+ suite .resolver .graph = graph .NewGraph [* types.Option ]()
316+
317+ parentOption := & types.Option {Description : "Parent" , Default : "new_parent_value" }
318+ childOption := & types.Option {Description : "Child" , Default : "child_default" }
319+
320+ suite .Require ().NoError (suite .resolver .graph .AddNode ("parent" , parentOption ))
321+ suite .Require ().NoError (suite .resolver .graph .AddNode ("child" , childOption ))
322+ suite .Require ().NoError (suite .resolver .graph .AddEdge ("parent" , "child" ))
323+ }
0 commit comments