@@ -76,57 +76,50 @@ func TestStepsWellFormed(t *testing.T) {
7676 t .Fatalf ("failed to validate topology: %v" , err )
7777 }
7878
79- serviceGroup := "Microsoft.Azure.ARO.HCP.Global"
80- service , err := topo .Lookup (serviceGroup )
81- if err != nil {
82- t .Fatalf ("failed to look up entrypoint %s in topology: %v" , serviceGroup , err )
83- }
84-
85- var e * topology.Entrypoint
86- for _ , option := range topo .Entrypoints {
87- if option .Identifier == serviceGroup {
88- e = & option
89- }
90- }
91- if e == nil {
92- t .Fatalf ("no entrypoint found for service group %s" , serviceGroup )
93- }
79+ for _ , entrypoint := range topo .Entrypoints {
80+ t .Run (entrypoint .Identifier , func (t * testing.T ) {
81+ service , err := topo .Lookup (entrypoint .Identifier )
82+ if err != nil {
83+ t .Fatalf ("failed to look up entrypoint %s in topology: %v" , entrypoint .Identifier , err )
84+ }
9485
95- pipelines := map [string ]* types.Pipeline {}
96- if err := entrypointutils .LoadPipelines (service , repoRootDir , pipelines , cfg ); err != nil {
97- t .Fatalf ("failed to load pipelines: %v" , err )
98- }
86+ pipelines := map [string ]* types.Pipeline {}
87+ if err := entrypointutils .LoadPipelines (service , repoRootDir , pipelines , cfg ); err != nil {
88+ t .Fatalf ("failed to load pipelines: %v" , err )
89+ }
9990
100- executionGraph , graphConstructionErr := graph .ForEntrypoint (& topo , e , pipelines )
101- if graphConstructionErr != nil {
102- t .Fatalf ("failed to construct graph: %v" , graphConstructionErr )
103- }
91+ executionGraph , graphConstructionErr := graph .ForEntrypoint (& topo , & entrypoint , pipelines )
92+ if graphConstructionErr != nil {
93+ t .Fatalf ("failed to construct graph: %v" , graphConstructionErr )
94+ }
10495
105- illFormed := map [string ]map [string ]map [string ]string {}
106- for serviceGroupName , resourceGroups := range executionGraph .Steps {
107- for resourceGroupName , steps := range resourceGroups {
108- for stepName , step := range steps {
109- if ! step .IsWellFormedOverInputs () {
110- reason := "unknown"
111- switch s := step .(type ) {
112- case * types.ShellStep :
113- if strings .Contains (s .Command , "make" ) && strings .Contains (s .Command , "deploy" ) {
114- reason = "helm step needing migration"
115- } else if s .WorkingDir == "" {
116- reason = "raw shell step needing working directory"
96+ illFormed := map [string ]map [string ]map [string ]string {}
97+ for serviceGroupName , resourceGroups := range executionGraph .Steps {
98+ for resourceGroupName , steps := range resourceGroups {
99+ for stepName , step := range steps {
100+ if ! step .IsWellFormedOverInputs () {
101+ reason := "unknown"
102+ switch s := step .(type ) {
103+ case * types.ShellStep :
104+ if strings .Contains (s .Command , "make" ) && strings .Contains (s .Command , "deploy" ) {
105+ reason = "helm step needing migration"
106+ } else if s .WorkingDir == "" {
107+ reason = "raw shell step needing working directory"
108+ }
109+ }
110+
111+ if _ , exists := illFormed [serviceGroupName ]; ! exists {
112+ illFormed [serviceGroupName ] = map [string ]map [string ]string {}
113+ }
114+ if _ , exists := illFormed [serviceGroupName ][resourceGroupName ]; ! exists {
115+ illFormed [serviceGroupName ][resourceGroupName ] = map [string ]string {}
116+ }
117+ illFormed [serviceGroupName ][resourceGroupName ][stepName ] = reason
118+ t .Errorf ("%s/%s/%s: step is ill-formed over inputs: %v" , serviceGroupName , resourceGroupName , stepName , reason )
117119 }
118120 }
119-
120- if _ , exists := illFormed [serviceGroupName ]; ! exists {
121- illFormed [serviceGroupName ] = map [string ]map [string ]string {}
122- }
123- if _ , exists := illFormed [serviceGroupName ][resourceGroupName ]; ! exists {
124- illFormed [serviceGroupName ][resourceGroupName ] = map [string ]string {}
125- }
126- illFormed [serviceGroupName ][resourceGroupName ][stepName ] = reason
127- t .Errorf ("%s/%s/%s: step is ill-formed over inputs: %v" , serviceGroupName , resourceGroupName , stepName , reason )
128121 }
129122 }
130- }
123+ })
131124 }
132125}
0 commit comments