<html>
  <head>
    <title>Test Report</title>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <style>
td {border:1px solid grey}
.test { background: red }
.test.flaky { background: yellow }
.test.pass { background: green }
.test.pass.flaky { background: green }
    </style>
  </head>
  <body>
    <h1>Rethinkdb {{ rethinkdb_version }}</h1>
    {% if buildbot %}
    <p>Build: <a href="{{ buildbot.build_link }}">{{ buildbot.build_id }}</a>
    {% endif %}
    <p>Branch: <a href="https://github.com/rethinkdb/rethinkdb/tree/{{ git_info.branch }}">{{ git_info.branch }}</a>
    <p>Commit: <a href="https://github.com/rethinkdb/rethinkdb/commit/{{ git_info.commit }}">{{ git_info.commit }}</a>
    <p>Commit message:
      <pre>{{ git_info.message }}</pre>
    <p>Passed {{ passed }} of  {{ total }} tests (filter: {{ filter }})</p>
    <table style='width:100%'>
      {% for test in tests %}
      <tr>
        <td>{{ test.name }}</td>
        <td>{{ test.repeat }}</td>
        <td class="test {{ test.status }} {% if test.flaky %}flaky{% endif %}">
          <a href='#{{ test.name }}_{{ test.repeat }}'
             onclick='$("#{{ test.name }}_{{ test.repeat }}").toggle()'>
            {{ test.status }}
          </a>
        </td>
        <td width='100%'></td></tr>
      <tr id='{{ test.name }}_{{ test.repeat }}' style='display:none'>
        <td colspan='4'>
          {% for file in test.files %}
          <ul><li><a href="{{ file.name }}">{{ file.name }}</a></ul>
          {% if file.contents %}
          <div style='border: 1px solid black'>
            <pre>{% for line in file.contents %}{{ line }}{% endfor %}</pre>
          </div>
          {% endif %}
          {% endfor %}
      </td></tr>
      {% endfor %}
    </table>
  </body>
</html>
