mirror of
https://github.com/ultravioletrs/cocos.git
synced 2026-06-23 04:10:25 +00:00
NOISSUE - Add health check (#288)
* add health check Signed-off-by: Sammy Oina <sammyoina@gmail.com> * add test case Signed-off-by: Sammy Oina <sammyoina@gmail.com> * fix lint and add test case Signed-off-by: Sammy Oina <sammyoina@gmail.com> * switch context Signed-off-by: Sammy Oina <sammyoina@gmail.com> --------- Signed-off-by: Sammy Oina <sammyoina@gmail.com>
This commit is contained in:
committed by
GitHub
parent
6043ad150b
commit
2a6fa8da25
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/ultravioletrs/cocos/agent/auth"
|
||||
"github.com/ultravioletrs/cocos/pkg/clients/grpc/agent"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
@@ -32,6 +33,8 @@ func decodeErros(err error) error {
|
||||
case errors.Contains(err, auth.ErrSignatureVerificationFailed):
|
||||
return auth.ErrSignatureVerificationFailed
|
||||
|
||||
case errors.Contains(err, agent.ErrAgentServiceUnavailable):
|
||||
return agent.ErrAgentServiceUnavailable
|
||||
default:
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/ultravioletrs/cocos/agent/auth"
|
||||
"github.com/ultravioletrs/cocos/pkg/clients/grpc/agent"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
@@ -46,6 +47,11 @@ func TestDecodeErros(t *testing.T) {
|
||||
input: errors.New("other error"),
|
||||
expected: errors.New("other error"),
|
||||
},
|
||||
{
|
||||
name: "Agent Service Unavailable",
|
||||
input: mgerrors.Wrap(agent.ErrAgentServiceUnavailable, errors.New("wrapped error")),
|
||||
expected: agent.ErrAgentServiceUnavailable,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
Reference in New Issue
Block a user