You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Arvid Heise (Jira)" <ji...@apache.org> on 2021/06/04 09:59:00 UTC

[jira] [Created] (FLINK-22876) Adding SharedObjects junit rule to ease test development

Arvid Heise created FLINK-22876:
-----------------------------------

             Summary: Adding SharedObjects junit rule to ease test development
                 Key: FLINK-22876
                 URL: https://issues.apache.org/jira/browse/FLINK-22876
             Project: Flink
          Issue Type: Improvement
          Components: Test Infrastructure
    Affects Versions: 1.14.0
            Reporter: Arvid Heise
            Assignee: Arvid Heise
             Fix For: 1.14.0


Most test rely on static variables to sync between test code and UDFs to avoid serialization issues. However, static variables are error-prone and the tests look quaint.
SharedObjects allow test developers to forget about the serialization and just use the objects across thread boundaries.

The main idea is that shared objects are bound to the scope of a test case instead of a class. That allows us to:
* get rid of all nasty reset methods for reused parts and most importantly avoid test bugs that result in us forgetting to reset (think of a latch in a shared WaitingSink)
* it’s easier to reason about the test setup
* it will allow us to share more code and provide more primitives (e.g. have some canonical way to wait for certain events)
* run tests in parallel that reuse classes depending on shared objects
* it will also be significantly easier to write tests for contributors. all student groups had issues with this synchronization of test code and UDFs.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)