@@ -209,6 +209,26 @@ func TestRunnerLabelFiltering(t *testing.T) {
209209 wantUpdated : true ,
210210 outputFile : "labelScalar.yml" ,
211211 },
212+ {
213+ name : "both slices overlap" ,
214+ inputFile : "labelArray.yml" ,
215+ config : HardenRunnerConfig {
216+ SkipHardenRunner : true ,
217+ RunnerLabels : []string {"windows-latest" , "ubuntu-latest" , "macos-latest" },
218+ },
219+ wantUpdated : true ,
220+ outputFile : "labelArray.yml" ,
221+ },
222+ {
223+ name : "both slices no overlap" ,
224+ inputFile : "labelArray.yml" ,
225+ config : HardenRunnerConfig {
226+ SkipHardenRunner : true ,
227+ RunnerLabels : []string {"windows-latest" , "macos-latest" },
228+ },
229+ wantUpdated : false ,
230+ unchanged : true ,
231+ },
212232 {
213233 name : "multi-job mixed labels" ,
214234 inputFile : "labelMultiJob.yml" ,
@@ -219,6 +239,36 @@ func TestRunnerLabelFiltering(t *testing.T) {
219239 wantUpdated : true ,
220240 outputFile : "labelMultiJob.yml" ,
221241 },
242+ {
243+ name : "mapping with labels array" ,
244+ inputFile : "labelMapping.yml" ,
245+ config : HardenRunnerConfig {
246+ SkipHardenRunner : true ,
247+ RunnerLabels : []string {"ubuntu-latest" },
248+ },
249+ wantUpdated : true ,
250+ outputFile : "labelMapping.yml" ,
251+ },
252+ {
253+ name : "mapping with labels scalar" ,
254+ inputFile : "labelMappingScalar.yml" ,
255+ config : HardenRunnerConfig {
256+ SkipHardenRunner : true ,
257+ RunnerLabels : []string {"ubuntu-latest" },
258+ },
259+ wantUpdated : true ,
260+ outputFile : "labelMappingScalar.yml" ,
261+ },
262+ {
263+ name : "mapping with labels no match" ,
264+ inputFile : "labelMapping.yml" ,
265+ config : HardenRunnerConfig {
266+ SkipHardenRunner : true ,
267+ RunnerLabels : []string {"windows-latest" },
268+ },
269+ wantUpdated : false ,
270+ unchanged : true ,
271+ },
222272 }
223273
224274 for _ , tt := range tests {
0 commit comments