Uploaded image for project: 'Sentry'
  1. Sentry
  2. SENTRY-1502

Multiple tests in TestSentryStore are not testing useful things

    XMLWordPrintableJSON

    Details

    • Type: Test
    • Status: Patch Available
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.7.0, 2.0.0
    • Fix Version/s: None
    • Component/s: Sentry
    • Labels:

      Description

      I noticed that multiple unit tests in TestSentryStore are not testing useful things. For example:

      @Test
        public void testCreateDropRole() throws Exception {
          String roleName = "test-drop-role";
          long seqId = sentryStore.createSentryRole(roleName).getSequenceId();
          assertEquals(seqId + 1, sentryStore.dropSentryRole(roleName).getSequenceId());
        }
      

      So this code only tests that there are no exceptions thrown. The assert is bogus - it tests that there was a single transaction in between which is a wrong test in the first place - number of transactions isn't a functionality. The test doesn't verify whether the role was actually created and whether it was correctly dropped. And it is similar for other tests as well.

        Attachments

        1. SENTRY-1502.001.patch
          12 kB
          Ruiming Zhou

          Issue Links

            Activity

              People

              • Assignee:
                skyapus@yahoo.com Ruiming Zhou
                Reporter:
                akolb Alex Kolbasov
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: