Implement SDL CLI 'healthcheck' -command 58/6958/10
authorTimo Tietavainen <timo.tietavainen@nokia.com>
Tue, 26 Oct 2021 06:11:53 +0000 (09:11 +0300)
committerTimo Tietavainen <timo.tietavainen@nokia.com>
Mon, 8 Nov 2021 05:27:38 +0000 (07:27 +0200)
commit977a55ca96d5dba1c7f9273671747eaf9cd6f894
tree9b64773043e45f895f99ed2666b0a379bd9bd27a
parentbf3832a4e8a0a5d9c0c83f784ae3778f4697fe61
Implement SDL CLI 'healthcheck' -command

Implement a new 'healthcheck' -command for SDL CLI to validate
healthiness of the SDL database. Under the hood 'healthcheck' -command
calls Redis client's 'Master' and 'Slaves' APIs and parses from the
responses master and slave Redis servers related fields to show the
overall healthiness of the SDL database backend.

Redis client's version was upgraded from v6.15.9 to v7 v7.4.1,
because old client didn't support 'Master' and 'Slaves' Redis
sentinel APIs. Also implement usage of Redis client's
'NewSentinelClient' client connection to read state information via
'Master' and 'Slaves' APIs. In case of standalone Redis server
deployment state information is read via Redis client's 'Info' API.

Issue-Id: RIC-113

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I7d964ac5c3d10cc90075977e2b11da7a9c11949d
15 files changed:
go.mod
go.sum
internal/cli/cli_private_fn_test.go [new file with mode: 0644]
internal/cli/healthcheck.go [new file with mode: 0644]
internal/cli/healthcheck_test.go [new file with mode: 0644]
internal/cli/root.go
internal/cli/types.go
internal/cli/utils.go [new file with mode: 0644]
internal/mocks/db_mocks_private_testing.go [new file with mode: 0644]
internal/sdlgoredis/dbinfo.go [new file with mode: 0644]
internal/sdlgoredis/dbstate.go [new file with mode: 0644]
internal/sdlgoredis/dbstate_test.go [new file with mode: 0644]
internal/sdlgoredis/sdlgoredis.go
internal/sdlgoredis/sdlgoredis_test.go
internal/sdlgoredis/sdlgosentinel.go [new file with mode: 0644]