debian-mirror-gitlab/doc/development/testing_guide/end_to_end/running_tests_that_require_special_setup.md

51 lines
2.2 KiB
Markdown
Raw Normal View History

2020-04-08 14:13:33 +05:30
# Running tests that require special setup
## Jenkins spec
2020-06-23 00:09:42 +05:30
The [`jenkins_build_status_spec`](https://gitlab.com/gitlab-org/gitlab/blob/163c8a8c814db26d11e104d1cb2dcf02eb567dbe/qa/qa/specs/features/ee/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb) spins up a Jenkins instance in a Docker container based on an image stored in the [GitLab-QA container registry](https://gitlab.com/gitlab-org/gitlab-qa/container_registry).
The Docker image it uses is preconfigured with some base data and plugins.
2020-04-08 14:13:33 +05:30
The test then configures the GitLab plugin in Jenkins with a URL of the GitLab instance that will be used
to run the tests. Unfortunately, the GitLab Jenkins plugin does not accept ports so `http://localhost:3000` would
2020-06-23 00:09:42 +05:30
not be accepted. Therefore, this requires us to run GitLab on port 80 or inside a Docker container.
2020-04-08 14:13:33 +05:30
2020-06-23 00:09:42 +05:30
To start a Docker container for GitLab based on the nightly image:
2020-04-08 14:13:33 +05:30
```shell
docker run \
--publish 80:80 \
--name gitlab \
--hostname localhost \
gitlab/gitlab-ee:nightly
```
To run the tests from the `/qa` directory:
```shell
CHROME_HEADLESS=false bin/qa Test::Instance::All http://localhost -- qa/specs/features/ee/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb
```
2020-06-23 00:09:42 +05:30
The test will automatically spin up a Docker container for Jenkins and tear down once the test completes.
2020-04-08 14:13:33 +05:30
However, if you need to run Jenkins manually outside of the tests, use this command:
```shell
docker run \
--hostname localhost \
--name jenkins-server \
--env JENKINS_HOME=jenkins_home \
--publish 8080:8080 \
registry.gitlab.com/gitlab-org/gitlab-qa/jenkins-gitlab:version1
```
Jenkins will be available on `http://localhost:8080`.
Admin username is `admin` and password is `password`.
It is worth noting that this is not an orchestrated test. It is [tagged with the `:orchestrated` meta](https://gitlab.com/gitlab-org/gitlab/blob/163c8a8c814db26d11e104d1cb2dcf02eb567dbe/qa/qa/specs/features/ee/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb#L5)
only to prevent it from running in the pipelines for live environments such as Staging.
### Troubleshooting
2020-06-23 00:09:42 +05:30
If Jenkins Docker container exits without providing any information in the logs, try increasing the memory used by
2020-04-08 14:13:33 +05:30
the Docker Engine.