Skip to content

Commit

Permalink
delete minor unreachable code caused by t.Fatal
Browse files Browse the repository at this point in the history
Signed-off-by: Abirdcfly <[email protected]>
  • Loading branch information
Abirdcfly committed Aug 10, 2022
1 parent 965abe3 commit c9b1e52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
14 changes: 3 additions & 11 deletions pkg/fab/orderer/orderer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ read:
case block, ok := <-blocks:
if ok {
t.Fatalf("Expected error got block: %#v", block)
break read
}
case err := <-errs:
if err == nil {
Expand All @@ -99,7 +98,6 @@ read:
break read
case <-time.After(time.Second * 5):
t.Fatal("Did not receive block or error from SendDeliver")
break read
}
}
}
Expand Down Expand Up @@ -231,7 +229,6 @@ read:
case block, ok := <-blocks:
if ok {
t.Fatalf("This usecase was not supposed to receive blocks : %#v", block)
break read
}
case err := <-errors:
if !strings.Contains(err.Error(), "BAD_REQUEST") {
Expand All @@ -240,7 +237,6 @@ read:
break read
case <-time.After(time.Second * 5):
t.Fatal("Did not receive error from SendDeliver")
break read
}
}
}
Expand Down Expand Up @@ -298,7 +294,6 @@ read:
case block, ok := <-blocks:
if ok {
t.Fatalf("This usecase was not supposed to get valid block %+v", block)
break read
}
case err := <-errs:
if err == nil || !strings.HasPrefix(err.Error(), "recv from ordering service failed") {
Expand All @@ -307,7 +302,6 @@ read:
break read
case <-time.After(time.Second * 5):
t.Fatal("Timeout: did not receive any response or error from SendDeliver")
break read
}
}
}
Expand Down Expand Up @@ -479,10 +473,8 @@ read:
break read
case err := <-errs:
t.Fatalf("Unexpected error from SendDeliver(): %s", err)
break read
case <-time.After(time.Second * 5):
t.Fatal("Did not receive block or error from SendDeliver")
break read
}
}

Expand Down Expand Up @@ -525,14 +517,14 @@ func TestForGRPCErrorsWithKeepAliveOpts(t *testing.T) {
}

func TestNewOrdererFromOrdererName(t *testing.T) {
t.Run("run simple FromOrdererName", func(t *testing.T){
t.Run("run simple FromOrdererName", func(t *testing.T) {
_, err := New(mocks.NewMockEndpointConfig(), FromOrdererName("orderer"))
if err != nil {
t.Fatalf("Failed to get new orderer from name. Error: %s", err)
}
})

t.Run("run FromOrdererName with Ignore orderer in config", func(t *testing.T){
t.Run("run FromOrdererName with Ignore orderer in config", func(t *testing.T) {
mockCtrl := gomock.NewController(t)
defer mockCtrl.Finish()
mockEndpoingCfg := mockfab.NewMockEndpointConfig(mockCtrl)
Expand All @@ -545,7 +537,7 @@ func TestNewOrdererFromOrdererName(t *testing.T) {
}
})

t.Run("run FromOrdererName with orderer not found in config", func(t *testing.T){
t.Run("run FromOrdererName with orderer not found in config", func(t *testing.T) {
mockCtrl := gomock.NewController(t)
defer mockCtrl.Finish()
mockEndpoingCfg := mockfab.NewMockEndpointConfig(mockCtrl)
Expand Down
1 change: 0 additions & 1 deletion pkg/util/concurrent/lazycache/lazycache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ func TestMustGetPanic(t *testing.T) {

cache.MustGet(NewStringKey("error"))
t.Fatal("Expecting panic but got none")
cache.Close()
}

type closableValue struct {
Expand Down

0 comments on commit c9b1e52

Please sign in to comment.