Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-1127 Fix failing and intermittent Ozone unit tests
  3. HDDS-5650

Wrong mock assumption in TestOmMetrics#testBucketOps

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.1.0
    • None
    • None
    • None
    • HDDS BadLands

    Description

      I noticed a mock in this test as follows:

      Mockito.doReturn(null).when(mockBm).getBucketInfo(null, null);

      But in reality the behavior would be different as per the source code:

      @Override
      public OmBucketInfo getBucketInfo(String volumeName, String bucketName)
       throws IOException {
       Preconditions.checkNotNull(volumeName);
       Preconditions.checkNotNull(bucketName);

       

      Due to the above preconditions, null is not allowed and it will throw NPE.

      Some one who familiar with this code can confirm why we added this differed mock behavior.

       

      Attachments

        Activity

          People

            aswinshakil Aswin Shakil
            umamaheswararao Uma Maheswara Rao G
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: