NOISSUE - Bump github.com/absmach/supermq from 0.18.2 to 0.18.4 (#564)

* Bump github.com/absmach/supermq from 0.18.2 to 0.18.4

Bumps [github.com/absmach/supermq](https://github.com/absmach/supermq) from 0.18.2 to 0.18.4.
- [Release notes](https://github.com/absmach/supermq/releases)
- [Commits](https://github.com/absmach/supermq/compare/v0.18.2...v0.18.4)

---
updated-dependencies:
- dependency-name: github.com/absmach/supermq
  dependency-version: 0.18.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Improve error handling for manager client connection failures in CLI commands

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sammy Oina <sammyoina@gmail.com>
This commit is contained in:
dependabot[bot]
2026-01-14 10:11:11 +01:00
committed by GitHub
parent 0a850b6bab
commit 5ae4f0f401
4 changed files with 122 additions and 85 deletions
+11 -3
View File
@@ -38,9 +38,13 @@ func (c *CLI) NewCreateVMCmd() *cobra.Command {
Example: `create-vm`,
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
if c.managerClient == nil || c.connectErr != nil {
if c.connectErr != nil {
printError(cmd, "Failed to connect to manager: %v ❌ ", c.connectErr)
return
}
if c.managerClient == nil {
if err := c.InitializeManagerClient(cmd); err != nil {
printError(cmd, "Failed to connect to manager: %v ❌ ", c.connectErr)
printError(cmd, "Failed to connect to manager: %v ❌ ", err)
return
}
}
@@ -94,7 +98,11 @@ func (c *CLI) NewRemoveVMCmd() *cobra.Command {
Example: `remove-vm <cvm_id>`,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
if c.managerClient == nil || c.connectErr != nil {
if c.connectErr != nil {
printError(cmd, "Failed to connect to manager: %v ❌ ", c.connectErr)
return
}
if c.managerClient == nil {
if err := c.InitializeManagerClient(cmd); err != nil {
printError(cmd, "Failed to connect to manager: %v ❌ ", err)
return
+4 -4
View File
@@ -102,7 +102,7 @@ func TestCLI_NewCreateVMCmd(t *testing.T) {
{
name: "manager client initialization failure",
setupMock: func(m *mocks.ManagerServiceClient) {
// No expectations set as initialization fails
// No expectations set as initialization fails before calling any methods
},
setupCLI: func(cli *CLI) {
cli.connectErr = errors.New("connection failed")
@@ -113,7 +113,7 @@ func TestCLI_NewCreateVMCmd(t *testing.T) {
flags: map[string]string{
"server-url": "https://server.com",
},
expectedError: "failed to exit idle mode: dns resolver: missing address ❌",
expectedError: "Failed to connect to manager: connection failed ❌",
expectError: true,
},
{
@@ -246,13 +246,13 @@ func TestCLI_NewRemoveVMCmd(t *testing.T) {
{
name: "manager client initialization failure",
setupMock: func(m *mocks.ManagerServiceClient) {
// No expectations set as initialization fails
// No expectations set as initialization fails before calling any methods
},
setupCLI: func(cli *CLI) {
cli.connectErr = errors.New("connection failed")
},
args: []string{"vm-123"},
expectedError: "failed to exit idle mode: dns resolver: missing address ❌",
expectedError: "Failed to connect to manager: connection failed ❌",
expectError: true,
},
{