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

GitLabAuthSourceTest fails

    XMLWordPrintable

    Details

    • Similar Issues:
    • Sprint:
      GSoC 2019. Community Bonding

      Description

      The test fails in `given_tokenCredentialwhenconvertthen_tokenAuth()` method of `GitLabAuthSourceTest` class.

      This function is responsible for checking if the `GitLabAuth` object returned by `AuthenticationTokens.convert(GitLabAuth, PersonalAccessToken)` is actually an instance of `GitLabAuthToken`. But the object returned is null while `PersonalAccessToken` object is not null.

      The error shown:

      ```

      java.lang.AssertionError: java.lang.AssertionError: Expected: an instance of io.jenkins.plugins.gitlabbranchsource.client.api.GitLabAuthToken     but: null
      {{ at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.junit.Assert.assertThat(Assert.java:956) at org.junit.Assert.assertThat(Assert.java:923) at io.jenkins.plugins.gitlabbranchsource.authentication.GitLabAuthSourceTest.given_tokenCredentialwhenconvertthen_tokenAuth(GitLabAuthSourceTest.java:31) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:548) at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298) at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.lang.Thread.run(Thread.java:748)}}

      ```

        Attachments

          Activity

          Hide
          baymac Parichay Barpanda added a comment -

          The GitLabAuthToken was not annotated with Extension so the credentials plugin always returned `null` for the runtime initalisation.

          Show
          baymac Parichay Barpanda added a comment - The GitLabAuthToken was not annotated with Extension so the credentials plugin always returned `null` for the runtime initalisation.
          Hide
          baymac Parichay Barpanda added a comment -

          Solved after adding GitLabAuthToken class to Extension list.

          Show
          baymac Parichay Barpanda added a comment - Solved after adding GitLabAuthToken class to Extension list.

            People

            Assignee:
            baymac Parichay Barpanda
            Reporter:
            baymac Parichay Barpanda
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: