From b5188101067ce5fec171f72b034bd9c5bc8100d3 Mon Sep 17 00:00:00 2001 From: Cesar Celis Hernandez Date: Fri, 24 Jun 2022 19:51:52 -0400 Subject: [PATCH] Avoid the crash in the test (#2147) --- operator-integration/tenant_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/operator-integration/tenant_test.go b/operator-integration/tenant_test.go index 02bc8b2e7..548020ede 100644 --- a/operator-integration/tenant_test.go +++ b/operator-integration/tenant_test.go @@ -635,7 +635,10 @@ func TestListTenantsByNameSpace(t *testing.T) { log.Println(err) assert.Nil(err) } - TenantName := &result.Tenants[0].Name // The array has to be empty, no index accessible + if len(result.Tenants) == 0 { + assert.Fail("FAIL: There are no tenants in the array") + } + TenantName := &result.Tenants[0].Name fmt.Println(*TenantName) assert.Equal("new-tenant", *TenantName, *TenantName) }