Skip to content

Commit

Permalink
[#633] replace escaped double quote for properties checksum calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
gtully committed Jul 3, 2023
1 parent a3c436d commit 6e46ff0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions controllers/activemqartemis_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2992,6 +2992,7 @@ func appendNonEmpty(propsKvs []string, data string) []string {
keyAndValue = strings.ReplaceAll(keyAndValue, `\ `, ` `)
keyAndValue = strings.ReplaceAll(keyAndValue, `\:`, `:`)
keyAndValue = strings.ReplaceAll(keyAndValue, `\=`, `=`)
keyAndValue = strings.ReplaceAll(keyAndValue, `\"`, `"`)
if keyAndValue != "" {
propsKvs = append(propsKvs, keyAndValue)
}
Expand Down
10 changes: 10 additions & 0 deletions controllers/activemqartemis_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,16 @@ func TestAlder32GenWithSpace(t *testing.T) {
assert.EqualValues(t, "2211202255", res)
}

func TestAlder32GenWithDots(t *testing.T) {

userProps := `addressSettings.#.redeliveryMultiplier=5
addressSettings.\"news.#\".redeliveryMultiplier=2
addressSettings.\"order.#\".redeliveryMultiplier=3`

res := alder32FromData([]byte(userProps))
assert.EqualValues(t, "3264295767", res)
}

func TestAlder32GenBrokerProps(t *testing.T) {

propsString := "# generated by crd\n#\nconnectionRouters.autoShard.keyType=CLIENT_ID\nconnectionRouters.autoShard.localTargetFilter=NULL|${STATEFUL_SET_ORDINAL}|-${STATEFUL_SET_ORDINAL}\nconnectionRouters.autoShard.policyConfiguration=CONSISTENT_HASH_MODULO\nconnectionRouters.autoShard.policyConfiguration.properties.MODULO=2\nacceptorConfigurations.tcp.params.router=autoShard\naddressesSettings.\"LB.#\".defaultAddressRoutingType=ANYCAST\n"
Expand Down

0 comments on commit 6e46ff0

Please sign in to comment.