mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-06 17:40:58 +00:00
chore(tests): add coverage for ./pkg/runner (#202)
Only changes test files. --- - remove tests specific to running on a host with no container they are the same as with the containers (TestRunEventHostEnvironment) - prefix the name of the tests with a distinctive name to more easily run them together - use code.forgejo.org/oci images whereever possible - remove some tests that are either - difficult to understand (ancient bugs) - not yet well understood (related to reusable workflows) - depend on github (generation of workflows to be run on the fly e.g. updateTestIfWorkflow) - fix the TestSanitizeNetworkAlias tests that were not run and make them easier to debug - disable tests of options that are forbidden in Forgejo Actions (testdata/container-hostname/push.yml) Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/202 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Co-authored-by: Earl Warren <contact@earl-warren.org> Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
parent
30ea23384a
commit
87d973b894
65 changed files with 218 additions and 656 deletions
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/nektos/act/pkg/model"
|
||||
)
|
||||
|
||||
func TestSetEnv(t *testing.T) {
|
||||
func TestCommandSetEnv(t *testing.T) {
|
||||
a := assert.New(t)
|
||||
ctx := context.Background()
|
||||
rc := new(RunContext)
|
||||
|
@ -24,7 +24,7 @@ func TestSetEnv(t *testing.T) {
|
|||
a.Equal("valz", rc.Env["x"])
|
||||
}
|
||||
|
||||
func TestSetOutput(t *testing.T) {
|
||||
func TestCommandSetOutput(t *testing.T) {
|
||||
a := assert.New(t)
|
||||
ctx := context.Background()
|
||||
rc := new(RunContext)
|
||||
|
@ -54,7 +54,7 @@ func TestSetOutput(t *testing.T) {
|
|||
a.Equal("percent2%\ntest", rc.StepResults["my-step"].Outputs["x:,\n%\r:"])
|
||||
}
|
||||
|
||||
func TestAddpath(t *testing.T) {
|
||||
func TestCommandAddpath(t *testing.T) {
|
||||
a := assert.New(t)
|
||||
ctx := context.Background()
|
||||
rc := new(RunContext)
|
||||
|
@ -67,7 +67,7 @@ func TestAddpath(t *testing.T) {
|
|||
a.Equal("/boo", rc.ExtraPath[0])
|
||||
}
|
||||
|
||||
func TestStopCommands(t *testing.T) {
|
||||
func TestCommandStopCommands(t *testing.T) {
|
||||
logger, hook := test.NewNullLogger()
|
||||
|
||||
a := assert.New(t)
|
||||
|
@ -92,7 +92,7 @@ func TestStopCommands(t *testing.T) {
|
|||
a.Contains(messages, " \U00002699 ::set-env name=x::abcd\n")
|
||||
}
|
||||
|
||||
func TestAddpathADO(t *testing.T) {
|
||||
func TestCommandAddpathADO(t *testing.T) {
|
||||
a := assert.New(t)
|
||||
ctx := context.Background()
|
||||
rc := new(RunContext)
|
||||
|
@ -105,7 +105,7 @@ func TestAddpathADO(t *testing.T) {
|
|||
a.Equal("/boo", rc.ExtraPath[0])
|
||||
}
|
||||
|
||||
func TestAddmask(t *testing.T) {
|
||||
func TestCommandAddmask(t *testing.T) {
|
||||
logger, hook := test.NewNullLogger()
|
||||
|
||||
a := assert.New(t)
|
||||
|
@ -147,7 +147,7 @@ func captureOutput(t *testing.T, f func()) string {
|
|||
return out
|
||||
}
|
||||
|
||||
func TestAddmaskUsemask(t *testing.T) {
|
||||
func TestCommandAddmaskUsemask(t *testing.T) {
|
||||
rc := new(RunContext)
|
||||
rc.StepResults = make(map[string]*model.StepResult)
|
||||
rc.CurrentStep = "my-step"
|
||||
|
@ -174,7 +174,7 @@ func TestAddmaskUsemask(t *testing.T) {
|
|||
a.Equal("[testjob] \U00002699 ***\n[testjob] \U00002699 ::set-output:: = token=***\n", re)
|
||||
}
|
||||
|
||||
func TestSaveState(t *testing.T) {
|
||||
func TestCommandSaveState(t *testing.T) {
|
||||
rc := &RunContext{
|
||||
CurrentStep: "step",
|
||||
StepResults: map[string]*model.StepResult{},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue