mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-11 17:50:58 +00:00
feat: use hashed uses string as cache dir name (#186)
Port of https://gitea.com/gitea/act/pulls/117 Refs forgejo/act#100 Co-authored-by: Jason Song <i@wolfogre.com> Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/186 Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
This commit is contained in:
parent
13ed94f5b7
commit
a157d24741
4 changed files with 49 additions and 6 deletions
|
@ -668,3 +668,37 @@ func TestReadWorkflow_WorkflowDispatchConfig(t *testing.T) {
|
|||
Type: "choice",
|
||||
}, workflowDispatch.Inputs["logLevel"])
|
||||
}
|
||||
|
||||
func TestStepUsesHash(t *testing.T) {
|
||||
type fields struct {
|
||||
Uses string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
fields fields
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "regular",
|
||||
fields: fields{
|
||||
Uses: "https://example.com/testa/testb@v3",
|
||||
},
|
||||
want: "e6/d70c1e8a4cc1e1cb02e32b3b60cc8dff319bb4fe5832fbc8b800711f18e7a2",
|
||||
},
|
||||
{
|
||||
name: "empty",
|
||||
fields: fields{
|
||||
Uses: "",
|
||||
},
|
||||
want: "e3/b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
s := &Step{
|
||||
Uses: tt.fields.Uses,
|
||||
}
|
||||
assert.Equalf(t, tt.want, s.UsesHash(), "UsesHash()")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue