1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-16 04:24:56 +02:00

internal/redis/channel.go: Change delimiter to "/"

This commit is contained in:
Henrik Hautakoski 2023-01-12 15:00:07 +01:00
parent dd9bd85801
commit 0e19f6d146
3 changed files with 6 additions and 6 deletions

View file

@ -18,7 +18,7 @@ func (c *Channel) Append(name string) {
}
func (c Channel) String() string {
return strings.Join(c, ".")
return strings.Join(c, "/")
}
// Define channels without any variables.

View file

@ -32,7 +32,7 @@ func TestChannel_String(t *testing.T) {
want string
}{
{"Empty", Channel{}, ""},
{"Alot", Channel{"one", "two", "three"}, "one.two.three"},
{"Alot", Channel{"one", "two", "three"}, "one/two/three"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -54,9 +54,9 @@ func TestActionChannel_String(t *testing.T) {
want string
}{
{"Empty", fields{}, "actions"},
{"Contract", fields{Contract: "mycontract"}, "actions.contract:mycontract"},
{"Action", fields{Action: "myaction"}, "actions.action:myaction"},
{"ContractAction", fields{Contract: "mycontract", Action: "myaction"}, "actions.contract:mycontract.action:myaction"},
{"Contract", fields{Contract: "mycontract"}, "actions/contract/mycontract"},
{"Action", fields{Action: "myaction"}, "actions/action/myaction"},
{"ContractAction", fields{Contract: "mycontract", Action: "myaction"}, "actions/contract/mycontract/action/myaction"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

View file

@ -15,7 +15,7 @@ func TestKey_String(t *testing.T) {
{"Empty", fields{NS: Namespace{}, Channel: Channel{}}, "ship::0000000000000000000000000000000000000000000000000000000000000000::"},
{"Transactions", fields{NS: Namespace{ChainID: "id"}, Channel: Channel{"transactions"}}, "ship::id::transactions"},
{"Nested", fields{NS: Namespace{ChainID: "id"}, Channel: Channel{"one.two"}}, "ship::id::one.two"},
{"Action", fields{NS: Namespace{ChainID: "id"}, Channel: ActionChannel{Contract: "mycontract"}}, "ship::id::actions.contract.mycontract"},
{"Action", fields{NS: Namespace{ChainID: "id"}, Channel: ActionChannel{Contract: "mycontract"}}, "ship::id::actions/contract/mycontract"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {