diff --git a/config/interpolate_funcs.go b/config/interpolate_funcs.go index d1755fe327..5ce7dc33a2 100644 --- a/config/interpolate_funcs.go +++ b/config/interpolate_funcs.go @@ -118,7 +118,7 @@ func Funcs() map[string]ast.Function { "min": interpolationFuncMin(), "pathexpand": interpolationFuncPathExpand(), "pow": interpolationFuncPow(), - "product": interpolationFuncProduct(), + "setproduct": interpolationFuncSetProduct(), "uuid": interpolationFuncUUID(), "replace": interpolationFuncReplace(), "rsadecrypt": interpolationFuncRsaDecrypt(), @@ -1741,9 +1741,9 @@ func interpolationFuncRsaDecrypt() ast.Function { } } -// interpolationFuncProduct implements the "product" function -// that returns the cartesian product of two or more lists -func interpolationFuncProduct() ast.Function { +// interpolationFuncSetProduct implements the "setproduct" function +// that returns the cartesian product of two or more lists or sets +func interpolationFuncSetProduct() ast.Function { return ast.Function{ ArgTypes: []ast.Type{ast.TypeList}, ReturnType: ast.TypeList, diff --git a/config/interpolate_funcs_test.go b/config/interpolate_funcs_test.go index 1035c020ef..dc3be5787a 100644 --- a/config/interpolate_funcs_test.go +++ b/config/interpolate_funcs_test.go @@ -2961,11 +2961,11 @@ H7CurtMwALQ/n/6LUKFmjRZjqbKX9SO2QSaC3grd6sY9Tu+bZjLe }) } -func TestInterpolateFuncProduct(t *testing.T) { +func TestInterpolateFuncSetProduct(t *testing.T) { testFunction(t, testFunctionConfig{ Cases: []testFunctionCase{ { - `${product(list("dev", "qas", "prd"), list("applicationA", "applicationB", "applicationC"))}`, + `${setproduct(list("dev", "qas", "prd"), list("applicationA", "applicationB", "applicationC"))}`, []interface{}{ []interface{}{"dev", "applicationA"}, []interface{}{"dev", "applicationB"}, @@ -2979,7 +2979,7 @@ func TestInterpolateFuncProduct(t *testing.T) { false, }, { - `${product(list("A", "B"), list("C", "D"), list("E", "F"))}`, + `${setproduct(list("A", "B"), list("C", "D"), list("E", "F"))}`, []interface{}{ []interface{}{"A", "C", "E"}, []interface{}{"A", "C", "F"}, @@ -2993,19 +2993,19 @@ func TestInterpolateFuncProduct(t *testing.T) { false, }, { - `${product(list(), list(), list())}`, + `${setproduct(list(), list(), list())}`, nil, true, }, { - `${product(list("foo"),list("bar"))}`, + `${setproduct(list("foo"),list("bar"))}`, []interface{}{ []interface{}{"foo", "bar"}, }, false, }, { - `${product(list("foo"))}`, + `${setproduct(list("foo"))}`, nil, true, },