mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-22 06:45:03 +01:00
refactor: move getContainerActionPaths into step interface (#13)
* allows to specialize local vs remote action implementation * allow paths like ./.. for local action Closes https://gitea.com/actions-oss/act-cli/issues/12 Reviewed-on: https://gitea.com/actions-oss/act-cli/pulls/13 Co-authored-by: ChristopherHX <christopher.homberger@web.de> Co-committed-by: ChristopherHX <christopher.homberger@web.de>
This commit is contained in:
committed by
ChristopherHX
parent
ee2e0135d5
commit
ce0890578a
@@ -345,3 +345,30 @@ func TestIsContinueOnError(t *testing.T) {
|
||||
assertObject.False(continueOnError)
|
||||
assertObject.NotNil(err)
|
||||
}
|
||||
|
||||
func TestSymlinkJoin(t *testing.T) {
|
||||
table := []struct {
|
||||
from string
|
||||
target string
|
||||
root []string
|
||||
result string
|
||||
err string
|
||||
}{
|
||||
{"/some/file/somewhere/action.yml", "../../../", []string{"/"}, "/", ""},
|
||||
{"/some/file/somewhere/action.yml", "../../../var/lib/act/action.yml", []string{"/some/file/somewhere", "/var/lib/act"}, "/var/lib/act/action.yml", ""},
|
||||
{"/some/file/somewhere/action.yml", "../../../var/lib/act/action.yml", []string{"/"}, "/var/lib/act/action.yml", ""},
|
||||
{"/some/file/somewhere/action.yml", "../../var/lib/act/action.yml", []string{"/some/file/somewhere", "/var/lib/act"}, "", "Not allowed"},
|
||||
{"/some/file/somewhere/action.yml", "../../var/lib/act/action.yml", []string{"/some/file", "/var/lib/act"}, "", "Not allowed"},
|
||||
{"/some/file/somewhere/action.yml", "../../var/lib/act/action.yml", []string{"/some/", "/var/lib/act"}, "/some/var/lib/act/action.yml", ""},
|
||||
}
|
||||
|
||||
for _, entry := range table {
|
||||
result, err := symlinkJoin(entry.from, entry.target, entry.root...)
|
||||
if entry.err == "" {
|
||||
assert.NoError(t, err)
|
||||
} else {
|
||||
assert.Error(t, err, entry.err)
|
||||
}
|
||||
assert.Equal(t, entry.result, result)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user