protected void assertNodeErrorReport(
      String errorMessage, String expectedContentOfLogFile, NodeConfig testNode)
      throws IOException, InterruptedException {
    Pattern errorReportInfoPattern = Pattern.compile("target/reports/error_report_.*.tar.gz");
    Matcher pathToReportMatcher = errorReportInfoPattern.matcher(errorMessage);
    assertTrue(pathToReportMatcher.find());

    Path report = Paths.get(pathToReportMatcher.group());
    assertNotNull(report);
    assertTrue(exists(report));

    CommandLibrary.createUnpackCommand(report, TEST_TMP_DIRECTORY).execute();
    Path puppetLogFile =
        TEST_TMP_DIRECTORY
            .resolve(testNode.getType().toString().toLowerCase())
            .resolve(spyInterrupter.getPuppetLogFile().getFileName());
    assertTrue(exists(puppetLogFile));

    String logFileContent = FileUtils.readFileToString(puppetLogFile.toFile());
    assertEquals(logFileContent, expectedContentOfLogFile);
  }