@@ -17,6 +17,8 @@ limitations under the License.
17
17
package suite
18
18
19
19
import (
20
+ "sort"
21
+
20
22
"k8s.io/apimachinery/pkg/util/sets"
21
23
22
24
confv1a1 "sigs.k8s.io/gateway-api/conformance/apis/v1alpha1"
@@ -72,9 +74,6 @@ func (p profileReportsMap) addTestResults(conformanceProfile ConformanceProfile,
72
74
if report .Extended == nil {
73
75
report .Extended = & confv1a1.ExtendedStatus {}
74
76
}
75
- if report .Extended .FailedTests == nil {
76
- report .Extended .FailedTests = []string {}
77
- }
78
77
report .Extended .FailedTests = append (report .Extended .FailedTests , result .test .ShortName )
79
78
report .Extended .Statistics .Failed ++
80
79
} else {
@@ -90,15 +89,9 @@ func (p profileReportsMap) addTestResults(conformanceProfile ConformanceProfile,
90
89
report .Extended = & confv1a1.ExtendedStatus {}
91
90
}
92
91
report .Extended .Statistics .Skipped ++
93
- if report .Extended .SkippedTests == nil {
94
- report .Extended .SkippedTests = []string {}
95
- }
96
92
report .Extended .SkippedTests = append (report .Extended .SkippedTests , result .test .ShortName )
97
93
} else {
98
94
report .Core .Statistics .Skipped ++
99
- if report .Core .SkippedTests == nil {
100
- report .Core .SkippedTests = []string {}
101
- }
102
95
report .Core .SkippedTests = append (report .Core .SkippedTests , result .test .ShortName )
103
96
}
104
97
}
@@ -140,10 +133,11 @@ func (p profileReportsMap) compileResults(supportedFeaturesMap map[ConformancePr
140
133
supportedFeatures := supportedFeaturesMap [ConformanceProfileName (report .Name )]
141
134
if report .Extended != nil {
142
135
if supportedFeatures != nil {
143
- if report .Extended .SupportedFeatures == nil {
144
- report .Extended .SupportedFeatures = make ([]string , 0 )
145
- }
146
- for _ , f := range supportedFeatures .UnsortedList () {
136
+ supportedFeatures := supportedFeatures .UnsortedList ()
137
+ sort .Slice (supportedFeatures , func (i , j int ) bool {
138
+ return supportedFeatures [i ] < supportedFeatures [j ]
139
+ })
140
+ for _ , f := range supportedFeatures {
147
141
report .Extended .SupportedFeatures = append (report .Extended .SupportedFeatures , string (f ))
148
142
}
149
143
}
@@ -152,10 +146,11 @@ func (p profileReportsMap) compileResults(supportedFeaturesMap map[ConformancePr
152
146
unsupportedFeatures := unsupportedFeaturesMap [ConformanceProfileName (report .Name )]
153
147
if report .Extended != nil {
154
148
if unsupportedFeatures != nil {
155
- if report .Extended .UnsupportedFeatures == nil {
156
- report .Extended .UnsupportedFeatures = make ([]string , 0 )
157
- }
158
- for _ , f := range unsupportedFeatures .UnsortedList () {
149
+ unsupportedFeatures := unsupportedFeatures .UnsortedList ()
150
+ sort .Slice (unsupportedFeatures , func (i , j int ) bool {
151
+ return unsupportedFeatures [i ] < unsupportedFeatures [j ]
152
+ })
153
+ for _ , f := range unsupportedFeatures {
159
154
report .Extended .UnsupportedFeatures = append (report .Extended .UnsupportedFeatures , string (f ))
160
155
}
161
156
}
0 commit comments