mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
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:
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user