Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.gitlab4j.api.GitLabApi;
import org.gitlab4j.api.GitLabApiException;
import org.gitlab4j.api.GroupApi;
import org.gitlab4j.api.ProjectApi;
import org.gitlab4j.api.models.*;
import org.jenkinsci.test.acceptance.docker.Docker;
Expand Down Expand Up @@ -65,17 +64,11 @@ public String getRepoUrl() {

public void waitForReady(CapybaraPortingLayer p) {
p.waitFor().withMessage("Waiting for GitLab to come up")
.withTimeout(Duration.ofSeconds(200)) // GitLab starts in about 2 minutes add some headway
.withTimeout(Duration.ofSeconds(600)) // GitLab starts in about 2 minutes add some headway
.pollingEvery(Duration.ofSeconds(2))
.until( () -> {
try {
HttpRequest request = HttpRequest.newBuilder()
.uri(getHttpUrl().toURI())
.GET()
.timeout(Duration.ofSeconds(1))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
return response.body().contains("GitLab Community Edition");
return checkReadiness();
} catch (IOException ignored) {
// we can not use .ignoring as this is a checked exception (even though a callable can throw this!)
return Boolean.FALSE;
Expand All @@ -85,7 +78,7 @@ public void waitForReady(CapybaraPortingLayer p) {
}

public HttpResponse<String> createRepo(String repoName, String token) throws RuntimeException {
try{
try {
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI(getHttpUrl() + "/api/v4/projects"))
.header("Content-Type", "application/json")
Expand Down Expand Up @@ -113,4 +106,10 @@ public String createUserToken(String userName, String password, String email, St
.popen()
.verifyOrDieWith("Unable to create user").trim();
}

public boolean checkReadiness() throws IOException, InterruptedException {
return Docker.cmd("exec", getCid()).add("/bin/bash", "-c", "curl http://127.0.0.1/-/readiness")
.popen()
.asText().trim().contains("\"status\":\"ok\"");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.inject.Injector;
import org.apache.commons.io.IOUtils;
import org.jenkinsci.test.acceptance.po.*;
import org.openqa.selenium.By;

import java.io.IOException;
import java.net.URL;
Expand All @@ -16,14 +17,11 @@ public GitLabOrganizationFolder(Injector injector, URL url, String name) {
}

public void create(String owner) {
control(by.path("/hetero-list-add[navigators]")).click();
find(by.partialLinkText("GitLab Group")).click();
find(by.path("/navigators/projectOwner")).sendKeys(owner);
}

@Override
public URL getConfigUrl() {
return null;
By navigators = by.path("/hetero-list-add[navigators]");
waitFor(navigators);
control(navigators)
.selectDropdownMenu("GitLab Group", 5);
waitFor(by.path("/navigators/projectOwner")).sendKeys(owner);
}

public String getCheckLog() {
Expand Down
20 changes: 14 additions & 6 deletions src/main/java/org/jenkinsci/test/acceptance/po/Control.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,23 +180,31 @@ public void set(Object text) {
* Class with {@link Describable} annotation.
*/
public void selectDropdownMenu(Class<?> type) {
selectDropdownMenu(type, 1);
}

public void selectDropdownMenu(String displayName) {
selectDropdownMenu(displayName, 1);
}

public void selectDropdownMenu(String displayName, long timeoutInSeconds) {
click();
WebElement we = findCaption(type,findDropDownMenuItem);
WebElement we = findDropDownMenuItem.find(displayName);
// the element may not yet be visible so wait for it to become shown after the click above
waitFor(we).pollingEvery(Duration.ofMillis(100)).withTimeout(Duration.ofSeconds(1)).until(we::isDisplayed);
waitFor(we).pollingEvery(Duration.ofMillis(100)).withTimeout(Duration.ofSeconds(timeoutInSeconds)).until(we::isDisplayed);
we.click();
// wait until the menu is hidden
waitFor(we).pollingEvery(Duration.ofMillis(100)).withTimeout(Duration.ofSeconds(10)).until(Control::isHiddenOrStale);
}

public void selectDropdownMenu(String displayName) {
public void selectDropdownMenu(Class<?> type, long timeoutInSeconds) {
click();
WebElement we = findDropDownMenuItem.find(displayName);
WebElement we = findCaption(type,findDropDownMenuItem);
// the element may not yet be visible so wait for it to become shown after the click above
waitFor(we).pollingEvery(Duration.ofMillis(100)).withTimeout(Duration.ofSeconds(1)).until(we::isDisplayed);
waitFor(we).pollingEvery(Duration.ofMillis(100)).withTimeout(Duration.ofSeconds(timeoutInSeconds)).until(we::isDisplayed);
we.click();
// wait until the menu is hidden
waitFor(we).pollingEvery(Duration.ofMillis(100)).withTimeout(Duration.ofSeconds(1)).until(Control::isHiddenOrStale);
waitFor(we).pollingEvery(Duration.ofMillis(100)).withTimeout(Duration.ofSeconds(10)).until(Control::isHiddenOrStale);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
FROM gitlab/gitlab-ce:16.6.0-ce.0

COPY create_user.rb /usr/bin/

COPY gitlab.rb /etc/gitlab/
# Expose the required ports
EXPOSE 80 443 22
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
gitlab_rails['max_request_duration_seconds'] = 180

gitlab_rails['gitlab_default_projects_features_issues'] = false

gitlab_rails['gitlab_default_projects_features_wiki'] = false

gitlab_rails['gitlab_default_projects_features_snippets'] = false

gitlab_rails['gitlab_default_projects_features_builds'] = false

gitlab_rails['gitlab_default_projects_features_container_registry'] = false

gitlab_rails['artifacts_enabled'] = false

gitlab_rails['usage_ping_enabled'] = false

puma['worker_timeout'] = 240

puma['worker_processes'] = 0

puma['per_worker_max_memory_mb'] = 1024

sidekiq['max_concurrency'] = 10

prometheus_monitoring['enable'] = false

gitlab_rails['env'] = {
'GITLAB_RAILS_RACK_TIMEOUT' => 200
}

gitlab_rails['env'] = {
'MALLOC_CONF' => 'dirty_decay_ms:1000,muzzy_decay_ms:1000'
}

gitaly['env'] = {
'MALLOC_CONF' => 'dirty_decay_ms:1000,muzzy_decay_ms:1000',
'GITALY_COMMAND_SPAWN_MAX_PARALLEL' => '2'
}
Loading