-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expose internal worker identifier for unicast task delivery
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package engine | ||
|
||
func (e *Engine) Worker() string { | ||
return e.wrk | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package engine | ||
|
||
import ( | ||
"fmt" | ||
"reflect" | ||
"testing" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
"github.com/xh3b4sd/redigo" | ||
) | ||
|
||
func Test_Engine_Worker(t *testing.T) { | ||
testCases := []struct { | ||
wrk string | ||
}{ | ||
// Case 000 | ||
{ | ||
wrk: "foo", | ||
}, | ||
// Case 001 | ||
{ | ||
wrk: "bar", | ||
}, | ||
// Case 002 | ||
{ | ||
wrk: "123", | ||
}, | ||
} | ||
|
||
for i, tc := range testCases { | ||
t.Run(fmt.Sprintf("%03d", i), func(t *testing.T) { | ||
var e *Engine | ||
{ | ||
e = New(Config{ | ||
Redigo: redigo.Fake(), | ||
Worker: tc.wrk, | ||
}) | ||
} | ||
|
||
wrk := e.Worker() | ||
|
||
if !reflect.DeepEqual(wrk, tc.wrk) { | ||
t.Fatalf("\n\n%s\n", cmp.Diff(tc.wrk, wrk)) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters