Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ public void execute(final String[] args) {
ServiceStatusCmd ssc = new ServiceStatusCmd();
ssc.execute(context, serviceStatusCommandOpts.json, serviceStatusCommandOpts.showHosts);
} else if (cl.getParsedCommand().equals("check")) {
executeCheckCommand(context, checkCommand, opts);
rc = executeCheckCommand(context, checkCommand, opts);
} else if (cl.getParsedCommand().equals("stopManager")
|| cl.getParsedCommand().equals("stopAll")) {
boolean everything = cl.getParsedCommand().equals("stopAll");
Expand Down Expand Up @@ -1372,7 +1372,7 @@ private static void getAllFateIds(TabletMetadata tabletMetadata,
}

@VisibleForTesting
public static void executeCheckCommand(ServerContext context, CheckCommand cmd,
public static int executeCheckCommand(ServerContext context, CheckCommand cmd,
ServerUtilOpts opts) throws Exception {
validateAndTransformCheckCommand(cmd);

Expand All @@ -1381,8 +1381,10 @@ public static void executeCheckCommand(ServerContext context, CheckCommand cmd,
} else if (cmd.run) {
var givenChecks = cmd.checks.stream()
.map(name -> CheckCommand.Check.valueOf(name.toUpperCase())).collect(Collectors.toList());
executeRunCheckCommand(cmd, givenChecks, context, opts);
return executeRunCheckCommand(cmd, givenChecks, context, opts);
}

return 0;
}

private static void validateAndTransformCheckCommand(CheckCommand cmd) {
Expand Down Expand Up @@ -1423,7 +1425,7 @@ private static void listChecks() {
System.out.println();
}

private static void executeRunCheckCommand(CheckCommand cmd, List<CheckCommand.Check> givenChecks,
private static int executeRunCheckCommand(CheckCommand cmd, List<CheckCommand.Check> givenChecks,
ServerContext context, ServerUtilOpts opts) throws Exception {
// Get all the checks in the order they are declared in the enum
final var allChecks = CheckCommand.Check.values();
Expand All @@ -1442,6 +1444,13 @@ private static void executeRunCheckCommand(CheckCommand cmd, List<CheckCommand.C
}

printChecksResults(checkStatus);

if (checkStatus.values().stream()
.anyMatch(status -> status == CheckCommand.CheckStatus.FAILED)) {
return 5;
} else {
return 0;
}
}

private static boolean depsFailed(CheckCommand.Check check,
Expand Down