Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-25220

Develop the ArchUnit Infra for test code and write an architectural rule for all IT cases w.r.t. MiniCluster

    XMLWordPrintableJSON

Details

    Description

      The original idea of this PR is to build architectural rules for ITCase and quickly found that current architecture test submodule only focuses on production code. In order to check the architecture violation of test code, followings should be done:

      • build the architecture test infra for test code
      • isolate the classpaths of production code and test code, i.e. separation of concers.
      • define architectural rules for ITCase
      • create ArchUnit test for some submodules

      The first try was using test jars of submodules and check the architectural violation centrally. There are some cons of this solution. First, it will need each submodule to create standard test jars that have conflict with some submodules who need extra exclusion filter for their test jars. Second, production code and test code mixed up, which makes it very difficult to define the scope of analyse classes for each rule, because some rules should only have effect on production code and others should only be used for test code. As second try, a distributed solution will be used. The architecture-test module will be split into three submodules: base for ArchUnit common extension, production for ArchUnit test of production code, test for defining rules for test code centrally. The real ArchUnit tests will be distributed and developed within submodules where architectural violation check is required.

      Architectural rules are required to verify that all IT cases should have:

      • for JUnit4

      a public, static, final member of type MiniClusterWithClientResource annotated with ClassRule.
      or
      a public, non-static, final member of type MiniClusterWithClientResource annotated with Rule.

      • for JUnit5

      a public, static, final member of type MiniClusterExtension
      and
      a public, static, final member of type AllCallbackWrapper annotated with RegisterExtension

      The inheritance hierarchy need to be checked, because the member of MiniCluster could be defined in the super class.

       

      Attachments

        Issue Links

          Activity

            People

              jingge Jing Ge
              jingge Jing Ge
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: