Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-85

PAssert needs sanity check that it's used correctly

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • P2
    • Resolution: Fixed
    • None
    • 0.5.0
    • sdk-java-core

    Description

      We should validate two things:

      1. DataflowAssert is not added to a pipeline that has already been run.
      2. The pipeline is run after the DataflowAssert is added.

      If either of these are not validated, then it is possible that the test doesn't actually verify anything.

      This code should throw an assertion error or fail in some other way.

      Pipeline p = TestPipeline.create();
      PCollection<Boolean> value = p.apply(Create.of(Boolean.FALSE));
      p.run();
      
      DataflowAssert.thatSingleton(value).isEqualTo(true);
      

      but it would pass silently.

      similarly, this code wills pass silently:

      Pipeline p = TestPipeline.create();
      PCollection<Boolean> value = p.apply(Create.of(Boolean.FALSE));
      DataflowAssert.thatSingleton(value).isEqualTo(true);
      

      Attachments

        Issue Links

          Activity

            People

              staslev Stas Levin
              dhalperi Dan Halperin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: