| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 346cf76 commit 67ab24f
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -50,27 +50,6 @@ def reset_gitlab(gl: gitlab.Gitlab) -> None: | |||
| 50 | 50 | helpers.safe_delete(user, hard_delete=True) | |
| 51 | 51 | ||
| 52 | 52 | ||
| 53 | - def set_token(container, fixture_dir): | ||
| 54 | - logging.info("Creating API token.") | ||
| 55 | - set_token_rb = fixture_dir / "set_token.rb" | ||
| 56 | - | ||
| 57 | - with open(set_token_rb, "r", encoding="utf-8") as f: | ||
| 58 | - set_token_command = f.read().strip() | ||
| 59 | - | ||
| 60 | - rails_command = [ | ||
| 61 | - "docker", | ||
| 62 | - "exec", | ||
| 63 | - container, | ||
| 64 | - "gitlab-rails", | ||
| 65 | - "runner", | ||
| 66 | - set_token_command, | ||
| 67 | - ] | ||
| 68 | - output = check_output(rails_command).decode().strip() | ||
| 69 | - logging.info("Finished creating API token.") | ||
| 70 | - | ||
| 71 | - return output | ||
| 72 | - | ||
| 73 | - | ||
| 74 | 53 | def pytest_report_collectionfinish(config, startdir, items): | |
| 75 | 54 | return [ | |
| 76 | 55 | "", | |
@@ -157,7 +136,7 @@ def _wait(timeout=30, step=0.5): | |||
| 157 | 136 | ||
| 158 | 137 | ||
| 159 | 138 | @pytest.fixture(scope="session") | |
| 160 | - def gitlab_config(check_is_alive, docker_ip, docker_services, temp_dir, fixture_dir): | ||
| 139 | + def gitlab_config(check_is_alive, docker_ip, docker_services, temp_dir): | ||
| 161 | 140 | config_file = temp_dir / "python-gitlab.cfg" | |
| 162 | 141 | port = docker_services.port_for("gitlab", 80) | |
| 163 | 142 | ||
@@ -174,15 +153,13 @@ def gitlab_config(check_is_alive, docker_ip, docker_services, temp_dir, fixture_ | |||
| 174 | 153 | f"GitLab container is now ready after {minutes} minute(s), {seconds} seconds" | |
| 175 | 154 | ) | |
| 176 | 155 | ||
| 177 | - token = set_token("gitlab-test", fixture_dir=fixture_dir) | ||
| 178 | - | ||
| 179 | 156 | config = f"""[global] | |
| 180 | 157 | default = local | |
| 181 | 158 | timeout = 60 | |
| 182 | 159 | ||
| 183 | 160 | [local] | |
| 184 | 161 | url = http://{docker_ip}:{port} | |
| 185 | - private_token = {token} | ||
| 162 | + private_token = python-gitlab-token | ||
| 186 | 163 | api_version = 4""" | |
| 187 | 164 | ||
| 188 | 165 | with open(config_file, "w", encoding="utf-8") as f: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,6 +31,12 @@ services: | |||
| 31 | 31 | gitlab_exporter['enable'] = false | |
| 32 | 32 | grafana['enable'] = false | |
| 33 | 33 | letsencrypt['enable'] = false | |
| 34 | + entrypoint: | ||
| 35 | + - /bin/sh | ||
| 36 | + - -c | ||
| 37 | + - chmod 644 /opt/gitlab/embedded/service/gitlab-rails/db/fixtures/production/* && /assets/wrapper | ||
| 38 | + volumes: | ||
| 39 | + - ${PWD}/tests/functional/fixtures/set_token.rb:/opt/gitlab/embedded/service/gitlab-rails/db/fixtures/production/003_set_token.rb | ||
| 34 | 40 | ports: | |
| 35 | 41 | - '8080:80' | |
| 36 | 42 | - '2222:22' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ skip_missing_interpreters = True | |||
| 5 | 5 | envlist = py310,py39,py38,py37,flake8,black,twine-check,mypy,isort,cz,pylint | |
| 6 | 6 | ||
| 7 | 7 | [testenv] | |
| 8 | - passenv = GITLAB_IMAGE GITLAB_TAG PY_COLORS NO_COLOR FORCE_COLOR DOCKER_HOST | ||
| 8 | + passenv = GITLAB_IMAGE GITLAB_TAG PY_COLORS NO_COLOR FORCE_COLOR DOCKER_HOST PWD | ||
| 9 | 9 | setenv = VIRTUAL_ENV={envdir} | |
| 10 | 10 | whitelist_externals = true | |
| 11 | 11 | usedevelop = True | |
| Back | FazBrowse Home | New Git URL |
0 commit comments