sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sravya Tirukkovalur (JIRA)" <>
Subject [jira] [Commented] (SENTRY-367) Add end to end tests for audit log
Date Thu, 14 Aug 2014 21:50:22 GMT


Sravya Tirukkovalur commented on SENTRY-367:

Hi Colin, yeah although I think the components(there may be more than one) depending on this
feature can have exhaustive tests at their end, I think we should have atleast basic e2e tests
in Sentry. So we could do something like having a dummy appender which appends log events
and our tests can verify from this list?

public class TestDbDDLAuditLog extends AbstractTestWithStaticConfiguration {

 public static class TestAppender extends AppenderSkeleton {
    public static List<LoggingEvent> events = new ArrayList<LoggingEvent>();
    public void close() {}
    public boolean requiresLayout() {return false;}
    protected void append(LoggingEvent event) {
    static String getLastLogEvent() {
      return events.get(events.size() - 1).getMessage().toString();
    static Level getLastLogLevel() {
      return events.get(events.size() - 1).getLevel();
  public static void setupTestStaticConfiguration() throws Exception {
    useSentryService = true;
    Logger logger = Logger.getLogger("sentry.hive.authorization.ddl.logger");
    TestAppender testAppender = new TestAppender();

  public void testBasic() throws Exception {
    statement.execute("CREATE ROLE " + roleName);
    assertThat(TestAppender.getLastLogLevel(), is(Level.INFO));
    JSONObject jsonObject= new JSONObject(TestAppender.getLastLogEvent());
    assertThat(jsonObject.get("operation").toString(), equalToIgnoringCase("CREATE_ROLE"));

What do you think?


> Add end to end tests for audit log
> ----------------------------------
>                 Key: SENTRY-367
>                 URL:
>             Project: Sentry
>          Issue Type: Sub-task
>            Reporter: Colin Ma
>            Assignee: Colin Ma
>            Priority: Minor
>         Attachments: sentry-367.v1.patch
> Add end to end test for audit log

This message was sent by Atlassian JIRA

View raw message