I have a test, which is using MySQL database configured and running on gitlab CI server (gitlab-ci.yml). I want that test to be disabled when it's running locally (it's using in-memory database instead). Is there any way to check if the test is running on GitLab Ci server? Something like:
if(isRunningOnGitlabCi()) {
Assert.assertThat(...);
}
Maybe there's environmental variable, which I can check ?
You can configure your job to use Unit test reports, and GitLab displays a report on the merge request so that it's easier and faster to identify the failure without having to check the entire log. Unit test reports currently only support test reports in the JUnit report format.
Project Creation on GitLabOpt the Initialize repository with a README option, this creates a README file so that the Git repository is initialised and has a default branch that can be cloned. Click Create project. Now clone the project on local.
Gitlab CI defines a large number of environment variables; you could use e.g. GITLAB_CI
.
Something like:
if(System.getenv("GITLAB_CI") != null) {
Assert.assertThat(...);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With