Applies https://github.com/nats-io/nats-server/pull/3887/files to dev (since the merge of main to dev of that PR effectively made it disappear (because stream transform changes included extracting transforms from accounts.go)

This commit is contained in:
Jean-Noël Moyne
2023-02-26 17:15:54 -08:00
parent 395409e2cd
commit cf53a47b01
2 changed files with 3 additions and 1 deletions

View File

@@ -109,7 +109,7 @@ func NewSubjectTransform(src, dest string) (*subjectTransform, error) {
dtokMappingFunctionIntArgs = append(dtokMappingFunctionIntArgs, -1)
dtokMappingFunctionStringArgs = append(dtokMappingFunctionStringArgs, _EMPTY_)
} else {
nphs++
nphs += len(transformArgWildcardIndexes)
// Now build up our runtime mapping from dest to source tokens.
var stis []int
for _, wildcardIndex := range transformArgWildcardIndexes {

View File

@@ -119,6 +119,8 @@ func TestSubjectTransforms(t *testing.T) {
shouldBeOK("baz.>", "mybaz.>")
shouldBeOK("*", "{{splitfromleft(1,1)}}")
shouldBeOK("", "prefix.>")
shouldBeOK("*.*", "{{partition(10,1,2)}}")
shouldBeOK("foo.*.*", "foo.{{wildcard(1)}}.{{wildcard(2)}}.{{partition(5,1,2)}}")
shouldMatch := func(src, dest, sample, expected string) {
t.Helper()