-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rename identity-1.audius-d -> identity.audius-d There will only be one * Add `audius-ctl test context` cmd * Remove unneeded code * Fix identity-1 -> identity hostnaming after rebase * Separate context test logic from cobra command * Add RPCs to test cmd * Return correct status codes for test context cmd, update ci --------- Co-authored-by: endline <[email protected]>
- Loading branch information
Showing
13 changed files
with
277 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/AudiusProject/audius-d/pkg/conf" | ||
"github.com/AudiusProject/audius-d/pkg/logger" | ||
"github.com/AudiusProject/audius-d/pkg/test" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
testCmd = &cobra.Command{ | ||
Use: "test [command]", | ||
Short: "test audius-d connectivity", | ||
Args: cobra.ExactArgs(0), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return nil | ||
}, | ||
} | ||
|
||
testContextCmd = &cobra.Command{ | ||
Use: "context", | ||
Short: "Test the health of the current context", | ||
SilenceUsage: true, // do not print --help text on failed node health | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
ctxConfig, err := conf.ReadOrCreateContextConfig() | ||
if err != nil { | ||
return logger.Error("Failed to retrieve context. ", err) | ||
} | ||
|
||
responses, err := test.CheckNodeHealth(ctxConfig) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
var encounteredError bool | ||
for _, response := range responses { | ||
if response.Error != nil { | ||
fmt.Printf("%-50s Error: %v\n", response.Host, response.Error) | ||
encounteredError = true | ||
} else { | ||
fmt.Printf("%-50s %t\n", response.Host, response.Result) | ||
} | ||
} | ||
|
||
if encounteredError { | ||
return fmt.Errorf("\none or more health checks failed") | ||
} | ||
|
||
return nil | ||
}, | ||
} | ||
) | ||
|
||
func init() { | ||
testCmd.AddCommand(testContextCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.