You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-12-11 21:57:08 +02:00
Another fix for settings field in pipeline config (#579)
close #578 - adjust to new settings field own pipeline config - more test coverage - Fix environment parse of settings - Fix pipeline schema
This commit is contained in:
@@ -18,6 +18,8 @@ func TestParamsToEnv(t *testing.T) {
|
||||
"complex": []struct{ Name string }{{"Jack"}, {"Jill"}},
|
||||
"complex2": struct{ Name string }{"Jack"},
|
||||
"from.address": "noreply@example.com",
|
||||
"tags": stringsToInterface("next", "latest"),
|
||||
"tag": stringsToInterface("next"),
|
||||
}
|
||||
want := map[string]string{
|
||||
"PLUGIN_STRING": "stringz",
|
||||
@@ -29,8 +31,18 @@ func TestParamsToEnv(t *testing.T) {
|
||||
"PLUGIN_COMPLEX": `[{"name":"Jack"},{"name":"Jill"}]`,
|
||||
"PLUGIN_COMPLEX2": `{"name":"Jack"}`,
|
||||
"PLUGIN_FROM_ADDRESS": "noreply@example.com",
|
||||
"PLUGIN_TAG": "next",
|
||||
"PLUGIN_TAGS": "next,latest",
|
||||
}
|
||||
got := map[string]string{}
|
||||
assert.NoError(t, paramsToEnv(from, got))
|
||||
assert.EqualValues(t, want, got, "Problem converting plugin parameters to environment variables")
|
||||
}
|
||||
|
||||
func stringsToInterface(val ...string) []interface{} {
|
||||
res := make([]interface{}, len(val))
|
||||
for i := range val {
|
||||
res[i] = val[i]
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user