| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 40827f4 commit c7c139b
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,18 +15,20 @@ def test_epics(group): | |||
| 15 | 15 | assert group.epics.list() | |
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | - @pytest.mark.xfail(reason="404 on issue.id") | ||
| 19 | 18 | def test_epic_issues(epic, issue): | |
| 20 | 19 | assert not epic.issues.list() | |
| 21 | 20 | ||
| 21 | + # FYI: Creating an issue causes a note to be created | ||
| 22 | 22 | epic_issue = epic.issues.create({"issue_id": issue.id}) | |
| 23 | 23 | assert epic.issues.list() | |
| 24 | 24 | ||
| 25 | + # FYI: Deleting an issue causes a note to be created | ||
| 25 | 26 | epic_issue.delete() | |
| 26 | 27 | ||
| 27 | 28 | ||
| 28 | 29 | def test_epic_notes(epic): | |
| 29 | - assert not epic.notes.list() | ||
| 30 | + notes = epic.notes.list(get_all=True) | ||
| 30 | 31 | ||
| 31 | 32 | epic.notes.create({"body": "Test note"}) | |
| 32 | - assert epic.notes.list() | ||
| 33 | + new_notes = epic.notes.list(get_all=True) | ||
| 34 | + assert len(new_notes) == (len(notes) + 1), f"{new_notes} {notes}" | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,6 +38,14 @@ def test_keys_deploy(gl, project, DEPLOY_KEY): | |||
| 38 | 38 | key_by_fingerprint = gl.keys.get(fingerprint=fingerprint) | |
| 39 | 39 | assert key_by_fingerprint.title == key.title | |
| 40 | 40 | assert key_by_fingerprint.key == key.key | |
| 41 | - assert len(key_by_fingerprint.deploy_keys_projects) == 1 | ||
| 41 | + | ||
| 42 | + if not any( | ||
| 43 | + key_project.get("project_id") == project.id | ||
| 44 | + for key_project in key_by_fingerprint.deploy_keys_projects | ||
| 45 | + ): | ||
| 46 | + raise AssertionError( | ||
| 47 | + f"Project {project} not found in 'deploy_keys_projects' " | ||
| 48 | + f"{key_by_fingerprint.pformat()}" | ||
| 49 | + ) | ||
| 42 | 50 | ||
| 43 | 51 | key.delete() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,6 @@ | |||
| 1 | + import pytest | ||
| 2 | + | ||
| 3 | + | ||
| 1 | 4 | # https://docs.gitlab.com/ee/ci/jobs/ci_job_token.html#allow-any-project-to-access-your-project | |
| 2 | 5 | def test_enable_limit_access_to_this_project(gl, project): | |
| 3 | 6 | scope = project.job_token_scope.get() | |
@@ -10,6 +13,7 @@ def test_enable_limit_access_to_this_project(gl, project): | |||
| 10 | 13 | assert scope.inbound_enabled | |
| 11 | 14 | ||
| 12 | 15 | ||
| 16 | + @pytest.mark.xfail(reason="https://gitlab.com/gitlab-org/gitlab/-/issues/582271") | ||
| 13 | 17 | def test_disable_limit_access_to_this_project(gl, project): | |
| 14 | 18 | scope = project.job_token_scope.get() | |
| 15 | 19 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,9 +26,9 @@ def test_create_project(gl, user): | |||
| 26 | 26 | ||
| 27 | 27 | sudo_project = gl.projects.create({"name": "sudo_project"}, sudo=user.id) | |
| 28 | 28 | ||
| 29 | - created = gl.projects.list() | ||
| 29 | + created = gl.projects.list(get_all=True) | ||
| 30 | 30 | created_gen = gl.projects.list(iterator=True) | |
| 31 | - owned = gl.projects.list(owned=True) | ||
| 31 | + owned = gl.projects.list(owned=True, get_all=True) | ||
| 32 | 32 | ||
| 33 | 33 | assert admin_project in created and sudo_project in created | |
| 34 | 34 | assert admin_project in owned and sudo_project not in owned | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | 1 | GITLAB_IMAGE=gitlab/gitlab-ee | |
| 2 | - GITLAB_TAG=17.8.2-ee.0 | ||
| 2 | + GITLAB_TAG=18.6.1-ee.0 | ||
| 3 | 3 | GITLAB_RUNNER_IMAGE=gitlab/gitlab-runner | |
| 4 | 4 | GITLAB_RUNNER_TAG=96856197 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,7 +34,7 @@ services: | |||
| 34 | 34 | entrypoint: | |
| 35 | 35 | - /bin/sh | |
| 36 | 36 | - -c | |
| 37 | - - ruby /create_license.rb && /assets/wrapper | ||
| 37 | + - ruby /create_license.rb && /assets/init-container | ||
| 38 | 38 | volumes: | |
| 39 | 39 | - ${PWD}/tests/functional/fixtures/create_license.rb:/create_license.rb | |
| 40 | 40 | ports: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,7 @@ | |||
| 9 | 9 | import gitlab | |
| 10 | 10 | import gitlab.base | |
| 11 | 11 | import gitlab.exceptions | |
| 12 | + import gitlab.v4.objects | ||
| 12 | 13 | ||
| 13 | 14 | SLEEP_INTERVAL = 0.5 | |
| 14 | 15 | TIMEOUT = 60 # seconds before timeout will occur | |
@@ -37,6 +38,11 @@ def safe_delete(object: gitlab.base.RESTObject) -> None: | |||
| 37 | 38 | object = manager.get(object.get_id()) # type: ignore[attr-defined] | |
| 38 | 39 | except gitlab.exceptions.GitlabGetError: | |
| 39 | 40 | return | |
| 41 | + # If object is already marked for deletion we have succeeded | ||
| 42 | + if getattr(object, "marked_for_deletion_on", None) is not None: | ||
| 43 | + # 'Group' and 'Project' objects have a 'marked_for_deletion_on' attribute | ||
| 44 | + logging.info(f"{object!r} is marked for deletion.") | ||
| 45 | + return | ||
| 40 | 46 | ||
| 41 | 47 | if index: | |
| 42 | 48 | logging.info(f"Attempt {index + 1} to delete {object!r}.") | |
@@ -52,22 +58,16 @@ def safe_delete(object: gitlab.base.RESTObject) -> None: | |||
| 52 | 58 | # we shouldn't cause test to fail if it still exists | |
| 53 | 59 | return | |
| 54 | 60 | elif isinstance(object, gitlab.v4.objects.Project): | |
| 55 | - # Immediately delete rather than waiting for at least 1day | ||
| 56 | - # https://docs.gitlab.com/ee/api/projects.html#delete-project | ||
| 57 | - object.delete(permanently_remove=True) | ||
| 58 | - pass | ||
| 61 | + # Starting in GitLab 18, projects can't be immediately deleted. | ||
| 62 | + # So this will mark it for deletion. | ||
| 63 | + object.delete() | ||
| 59 | 64 | else: | |
| 60 | 65 | # We only attempt to delete parent groups to prevent dangling sub-groups | |
| 61 | - # However parent groups can only be deleted on a delay in Gl 16 | ||
| 66 | + # However parent groups can only be deleted on a delay in GitLab 16 | ||
| 62 | 67 | # https://docs.gitlab.com/ee/api/groups.html#remove-group | |
| 63 | 68 | object.delete() | |
| 64 | 69 | except gitlab.exceptions.GitlabDeleteError: | |
| 65 | - logging.info(f"{object!r} already deleted or scheduled for deletion.") | ||
| 66 | - if isinstance(object, gitlab.v4.objects.Group): | ||
| 67 | - # Parent groups can never be immediately deleted in GL 16, | ||
| 68 | - # so don't cause test to fail if it still exists | ||
| 69 | - return | ||
| 70 | - pass | ||
| 70 | + logging.exception(f"Error attempting to delete: {object.pformat()}") | ||
| 71 | 71 | ||
| 72 | 72 | time.sleep(SLEEP_INTERVAL) | |
| 73 | 73 | pytest.fail(f"{object!r} was not deleted") | |
| Back | FazBrowse Home | New Git URL |
0 commit comments