Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-51442

Provide API to write tests for JEP-200 compatibility

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Not A Defect
    • Component/s: core
    • Labels:
    • Similar Issues:

      Description

      I'm currently checking if my plug-ins conform to JEP-200. There seems to be no easy way to check if a class is compatible with serialization of JEP-200. Currently, you need to deploy the plug-in to Jenkins and manually test if everything works as expected.

      For all of my classes that are Serializable, I wrote a SerializationTest that checks that the class could be serialized using Java serialization or XStream serialization. The same thing is missing for JEP-200 serialization. Please provide a way to simply serialize and deserialize an object using your JEP-200 implementation.

      Examples

        Attachments

          Issue Links

            Activity

            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            I have created some basic test functionality for that, e.g. in https://github.com/jenkinsci/github-api-plugin/pull/18 and in some other PRs.
            E,g, JENKINS-48968 is one of the tasks for that.

            Jesse Glick was against spending time on such generic tests due to the limited achievable coverage IIRC.

            Show
            oleg_nenashev Oleg Nenashev added a comment - I have created some basic test functionality for that, e.g. in https://github.com/jenkinsci/github-api-plugin/pull/18 and in some other PRs. E,g, JENKINS-48968 is one of the tasks for that. Jesse Glick was against spending time on such generic tests due to the limited achievable coverage IIRC.
            Hide
            drulli Ulli Hafner added a comment -

            In your test case I do not see that the security checks are started? Are they automatically active because this test uses JenkinsRule? Then it should be sufficient that I start my serializable tests as integration test.

            Show
            drulli Ulli Hafner added a comment - In your test case I do not see that the security checks are started? Are they automatically active because this test uses JenkinsRule ? Then it should be sufficient that I start my serializable tests as integration test.
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Ulli Hafner Yes, all JenkinsRule-based tests will get JEP-200 enabled automatically for Jenkins 2.102+.

            In other tests, ff you use XStream class instance in your tests, make sure you use the Singleton from Jenkins or instantiate XStream2

            Show
            oleg_nenashev Oleg Nenashev added a comment - Ulli Hafner Yes, all JenkinsRule-based tests will get JEP-200 enabled automatically for Jenkins 2.102+. In other tests, ff you use XStream class instance in your tests, make sure you use the Singleton from Jenkins or instantiate XStream2
            Hide
            drulli Ulli Hafner added a comment -

            I just confirmed that starting my serialization test as integration test just does everything I need. So I think it is ok to close this issue.

            Show
            drulli Ulli Hafner added a comment - I just confirmed that starting my serialization test as integration test just does everything I need. So I think it is ok to close this issue.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              drulli Ulli Hafner
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: