mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-02-07 18:56:35 -05:00
30 lines
637 B
Go
30 lines
637 B
Go
![]() |
// SPDX-License-Identifier: MIT
|
||
|
|
||
|
package actions
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestActionRunJob_ItRunsOn(t *testing.T) {
|
||
|
actionJob := ActionRunJob{RunsOn: []string{"ubuntu"}}
|
||
|
agentLabels := []string{"ubuntu", "node-20"}
|
||
|
|
||
|
assert.True(t, actionJob.ItRunsOn(agentLabels))
|
||
|
assert.False(t, actionJob.ItRunsOn([]string{}))
|
||
|
|
||
|
actionJob.RunsOn = append(actionJob.RunsOn, "node-20")
|
||
|
|
||
|
assert.True(t, actionJob.ItRunsOn(agentLabels))
|
||
|
|
||
|
agentLabels = []string{"ubuntu"}
|
||
|
|
||
|
assert.False(t, actionJob.ItRunsOn(agentLabels))
|
||
|
|
||
|
actionJob.RunsOn = []string{}
|
||
|
|
||
|
assert.False(t, actionJob.ItRunsOn(agentLabels))
|
||
|
}
|