-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Gitlab Test Server to 17.7.0 #658
- Loading branch information
1 parent
f0fb7fa
commit 58e99d8
Showing
7 changed files
with
113 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,6 +143,13 @@ void testGetNamespaces() throws Exception { | |
jsonObject.addProperty("avatar_url", //$NON-NLS-1$ | ||
"https://secure.gravatar.com/avatar/42?s\u003d80\u0026d\u003didenticon"); //$NON-NLS-1$ | ||
} | ||
// Adapt repository URL if necessary | ||
if (!"https://gitlab.mylyn.local".equals(GitlabTestFixture.current().getRepositoryUrl())) { | ||
String webURL = jsonObject.get("web_url") | ||
.getAsString() | ||
.replace(GitlabTestFixture.current().getRepositoryUrl(), "https://gitlab.mylyn.local"); | ||
jsonObject.addProperty("web_url", webURL); | ||
} | ||
} | ||
techUsers.sort(Comparator.naturalOrder()); | ||
String fName = "testdata/getNamespaces" + (techUsers.size() > 0 ? "_" : "") + String.join("_", techUsers) | ||
|
@@ -167,6 +174,14 @@ void testGetUser() throws Exception { | |
userObj.remove("current_sign_in_at"); //$NON-NLS-1$ | ||
// The avatar_url can change with a newer Gitlab version | ||
userObj.remove("avatar_url"); //$NON-NLS-1$ | ||
|
||
// Adapt repository URL if necessary | ||
if (!"https://gitlab.mylyn.local".equals(GitlabTestFixture.current().getRepositoryUrl())) { | ||
String webURL = userObj.get("web_url") | ||
.getAsString() | ||
.replace(GitlabTestFixture.current().getRepositoryUrl(), "https://gitlab.mylyn.local"); | ||
userObj.addProperty("web_url", webURL); | ||
} | ||
String actual = new GsonBuilder().setPrettyPrinting().create().toJson(user); | ||
String expectedStr = IOUtils.toString(CommonTestUtil.getResource(this, "testdata/getUser.json"), //$NON-NLS-1$ | ||
Charset.defaultCharset()); | ||
|
@@ -193,6 +208,22 @@ void testGetUsers() throws Exception { | |
jsonObject.remove("current_sign_in_at"); //$NON-NLS-1$ | ||
// The avatar_url can change with a newer Gitlab version | ||
jsonObject.remove("avatar_url"); //$NON-NLS-1$ | ||
|
||
// Adapt repository URL if necessary | ||
if (!"https://gitlab.mylyn.local".equals(GitlabTestFixture.current().getRepositoryUrl())) { | ||
String webURL = jsonObject.get("web_url") | ||
.getAsString() | ||
.replace(GitlabTestFixture.current().getRepositoryUrl(), "https://gitlab.mylyn.local"); | ||
jsonObject.addProperty("web_url", webURL); | ||
} | ||
// change administrator email | ||
if (jsonObject.get("email").getAsString().startsWith("gitlab_admin_")) { | ||
jsonObject.addProperty("email", "[email protected]"); | ||
} | ||
if (jsonObject.get("commit_email").getAsString().startsWith("gitlab_admin_")) { | ||
jsonObject.addProperty("commit_email", "[email protected]"); | ||
} | ||
|
||
} | ||
techUsers.sort(Comparator.naturalOrder()); | ||
String fName = "testdata/getUsers" + (techUsers.size() > 0 ? "_" : "") + String.join("_", techUsers) + ".json"; | ||
|
@@ -209,6 +240,13 @@ void testGetGroups() throws Exception { | |
for (JsonElement resultObj : resultElement.getAsJsonArray()) { | ||
JsonObject jsonObject = resultObj.getAsJsonObject(); | ||
jsonObject.addProperty("created_at", "2024-02-14T11:11:11.111Z"); //$NON-NLS-1$ //$NON-NLS-2$ | ||
// Adapt repository URL if necessary | ||
if (!"https://gitlab.mylyn.local".equals(GitlabTestFixture.current().getRepositoryUrl())) { | ||
String webURL = jsonObject.get("web_url") | ||
.getAsString() | ||
.replace(GitlabTestFixture.current().getRepositoryUrl(), "https://gitlab.mylyn.local"); | ||
jsonObject.addProperty("web_url", webURL); | ||
} | ||
} | ||
String actual = new GsonBuilder().setPrettyPrinting().create().toJson(resultElement); | ||
String expected = IOUtils.toString(CommonTestUtil.getResource(this, "testdata/getGroups.json"), //$NON-NLS-1$ | ||
|
@@ -232,6 +270,13 @@ void testgetConfiguration() throws Exception { | |
user.remove("current_sign_in_at"); //$NON-NLS-1$ | ||
// The avatar_url can change with a newer Gitlab version | ||
user.remove("avatar_url"); //$NON-NLS-1$ | ||
// Adapt repository URL if necessary | ||
if (!"https://gitlab.mylyn.local".equals(GitlabTestFixture.current().getRepositoryUrl())) { | ||
String webURL = user.get("web_url") | ||
.getAsString() | ||
.replace(GitlabTestFixture.current().getRepositoryUrl(), "https://gitlab.mylyn.local"); | ||
user.addProperty("web_url", webURL); | ||
} | ||
|
||
for (Integer integer : configuration.getProjectIDs()) { | ||
JsonObject project = configuration.getProductWithID(integer); | ||
|
@@ -245,13 +290,24 @@ void testgetConfiguration() throws Exception { | |
project.remove("open_issues_count"); //$NON-NLS-1$ | ||
project.remove("runners_token"); //$NON-NLS-1$ | ||
project.addProperty("auto_devops_enabled", true); //$NON-NLS-1$ | ||
// Adapt repository URL if necessary | ||
if (!"https://gitlab.mylyn.local".equals(GitlabTestFixture.current().getRepositoryUrl())) { | ||
String ssh_url_to_repo = project.get("ssh_url_to_repo") | ||
.getAsString() | ||
.replace(GitlabTestFixture.current().getRepositoryUrl().substring(8), "gitlab.mylyn.local"); | ||
project.addProperty("ssh_url_to_repo", ssh_url_to_repo); | ||
} | ||
|
||
} | ||
for (String string : configuration.getGroupNames()) { | ||
JsonObject group = configuration.getGroupDetail(string).getAsJsonObject(); | ||
group.remove("created_at"); //$NON-NLS-1$ | ||
group.remove("runners_token"); //$NON-NLS-1$ | ||
} | ||
String actual = new GsonBuilder().setPrettyPrinting().create().toJson(configuration); | ||
String actual = new GsonBuilder().setPrettyPrinting() | ||
.create() | ||
.toJson(configuration) | ||
.replace(GitlabTestFixture.current().getRepositoryUrl(), "https://gitlab.mylyn.local"); | ||
String expected = IOUtils.toString(CommonTestUtil.getResource(this, "testdata/configuration.json"), //$NON-NLS-1$ | ||
Charset.defaultCharset()); | ||
assertEquals(expected, actual); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters