From 1d1ee11c48e1078a48c31e1160361b87044b4c5d Mon Sep 17 00:00:00 2001 From: Dmitry Kropachev Date: Fri, 5 Jul 2024 22:43:21 -0400 Subject: [PATCH] Make tablet test provide more details on failure Time to time this test fails due to not obviouse reason To make it possible investigate the issue we need to drop more details when it happens --- tablet_integration_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tablet_integration_test.go b/tablet_integration_test.go index aec8d744e..d8ddb3a69 100644 --- a/tablet_integration_test.go +++ b/tablet_integration_test.go @@ -69,7 +69,9 @@ func TestTablets(t *testing.T) { } } - assertEqual(t, "queriedHosts", 1, queriedHosts) + if queriedHosts != 1 { + t.Fatalf("trace should show only one host but it showed %d hosts, hosts: %s trace:\n%s", queriedHosts, hostAddresses, buf.String()) + } } } @@ -123,12 +125,14 @@ func TestTabletsShardAwareness(t *testing.T) { allShards := make(map[string]bool) shardList := []string{} for _, item := range shards { - if _, value := allShards[item]; !value { + if !allShards[item] { allShards[item] = true shardList = append(shardList, item) } } - assertEqual(t, "shardList", 1, len(shardList)) + if len(shardList) != 1 { + t.Fatalf("trace should show only one shard but it showed %d shards, shards: %s trace:\n%s", len(shardList), shardList, buf.String()) + } } }