Panic when registering the same type but diff urls

Panic on typeurl registration when you register the same type but
different urls for that type.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-07-24 15:51:09 -04:00
parent c52523c4d3
commit a3769f887b
2 changed files with 20 additions and 3 deletions

View File

@@ -130,6 +130,17 @@ func TestMarshalEvent(t *testing.T) {
}
}
func TestRegisterDiffUrls(t *testing.T) {
clear()
defer func() {
if err := recover(); err == nil {
t.Error("registering the same type with different urls should panic")
}
}()
Register(&test{}, "test")
Register(&test{}, "test", "two")
}
func BenchmarkMarshalEvent(b *testing.B) {
ev := &eventsapi.TaskStart{}
expected, err := MarshalAny(ev)