diff options
Diffstat (limited to 'models/actions/run_job_test.go')
-rw-r--r-- | models/actions/run_job_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/models/actions/run_job_test.go b/models/actions/run_job_test.go new file mode 100644 index 0000000000..50a4ba10d8 --- /dev/null +++ b/models/actions/run_job_test.go @@ -0,0 +1,29 @@ +// 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)) +} |