Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved error reporting by CLion integartion tests #6877

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -878,7 +878,7 @@ private static void logSyncError(BlazeContext context, Throwable e) {
}
cause = cause.getCause();
}
logger.error(e);
IssueOutput.error("Internal error: " + e.getMessage()).submit(context);
logger.error(e);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ protected SyncOutput runSync(BlazeSyncParams params) {
context.close();
LOG.info(String.format("PROJECT SYNC LOG:%n%s", output.collectLog()));

output.setHasErrors(context.hasErrors());
return output;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class SyncOutput {
private @Nullable Boolean hasErrors = null;

private final List<IssueOutput> issues = new ArrayList<>();
private final List<String> messages = new ArrayList<>();

Expand All @@ -28,6 +29,10 @@ void install(BlazeContext context) {
addOutputSink(context, SummaryOutput.class, (it) -> messages.add(it.getText()));
}

void setHasErrors(boolean hasErrors) {
this.hasErrors = hasErrors;
}

private <T extends Output> void addOutputSink(BlazeContext context, Class<T> clazz, Consumer<T> consumer) {
context.addOutputSink(clazz, (it) -> {
consumer.accept(it);
Expand Down Expand Up @@ -59,6 +64,7 @@ public void assertNoErrors() {
collectLog()
);

assertThat(issues).isEmpty();
assertWithMessage(message).that(issues).isEmpty();
assertWithMessage(message).that(hasErrors).isFalse();
}
}