From 2b02a4246ba5bd0a0b5f006ba6902dd7f2207966 Mon Sep 17 00:00:00 2001 From: Marek Markiewka Date: Mon, 22 Feb 2021 12:55:34 +0100 Subject: [PATCH 1/2] changed location of httpresponse.header to Location since lowercase yields a null object Signed-off-by: Marek Markiewka --- src/com/cloudogu/ces/cesbuildlib/SCMManager.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/cloudogu/ces/cesbuildlib/SCMManager.groovy b/src/com/cloudogu/ces/cesbuildlib/SCMManager.groovy index 008b0557..9b2354b5 100644 --- a/src/com/cloudogu/ces/cesbuildlib/SCMManager.groovy +++ b/src/com/cloudogu/ces/cesbuildlib/SCMManager.groovy @@ -45,7 +45,7 @@ class SCMManager implements Serializable { } // example: "location: https://some/pr/42" - extract id - return httpResponse.headers.location.split("/")[-1] + return httpResponse.headers.Location.split("/")[-1] } boolean updatePullRequest(String repository, String pullRequestId, String title, String description) { From 69e73a4454e87739183def177b94ce1f89e74443 Mon Sep 17 00:00:00 2001 From: Marek Markiewka Date: Mon, 22 Feb 2021 12:58:52 +0100 Subject: [PATCH 2/2] adjusted tests Signed-off-by: Marek Markiewka --- test/com/cloudogu/ces/cesbuildlib/SCMManagerTest.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/com/cloudogu/ces/cesbuildlib/SCMManagerTest.groovy b/test/com/cloudogu/ces/cesbuildlib/SCMManagerTest.groovy index 3edc2e32..e4e7af30 100644 --- a/test/com/cloudogu/ces/cesbuildlib/SCMManagerTest.groovy +++ b/test/com/cloudogu/ces/cesbuildlib/SCMManagerTest.groovy @@ -98,7 +98,7 @@ class SCMManagerTest { return [ httpCode: '201', - headers: [ location: 'https://a/long/url/with/id/id/12' ] + headers: [ Location: 'https://a/long/url/with/id/id/12' ] ] }) @@ -110,7 +110,7 @@ class SCMManagerTest { void "error on pull request creation makes build unstable"() { when(httpMock.post(any(), any(), any())).thenReturn([ httpCode: '500', - headers: [ location: 'https://a/long/url/with/id/id/12' ] + headers: [ Location: 'https://a/long/url/with/id/id/12' ] ]) def id = scmm.createPullRequest(repo, 'source', 'target', 'title', 'description') @@ -192,7 +192,7 @@ class SCMManagerTest { return [ httpCode: '201', - headers: [ location: 'https://a/long/url/with/id/id/12' ] + headers: [ Location: 'https://a/long/url/with/id/id/12' ] ] })