From 69014e9be3a781be6742478af820ea097d004791 Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Wed, 27 Jul 2022 09:21:35 -0700 Subject: test(functional): bump GitLab docker image to 15.2.0-ee.0 Use the GitLab docker image 15.2.0-ee.0 in the functional testing. --- tests/functional/fixtures/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/functional') diff --git a/tests/functional/fixtures/.env b/tests/functional/fixtures/.env index e7be6c9..9be02fe 100644 --- a/tests/functional/fixtures/.env +++ b/tests/functional/fixtures/.env @@ -1,2 +1,2 @@ GITLAB_IMAGE=gitlab/gitlab-ee -GITLAB_TAG=14.9.2-ee.0 +GITLAB_TAG=15.2.0-ee.0 -- cgit v1.2.1 From 271f6880dbb15b56305efc1fc73924ac26fb97ad Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Thu, 28 Jul 2022 21:01:41 -0700 Subject: chore(topics): 'title' is required when creating a topic In GitLab >= 15.0 `title` is required when creating a topic. --- tests/functional/api/test_topics.py | 11 +++++++++-- tests/functional/conftest.py | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 'tests/functional') diff --git a/tests/functional/api/test_topics.py b/tests/functional/api/test_topics.py index 7ad71a5..0d6a3ef 100644 --- a/tests/functional/api/test_topics.py +++ b/tests/functional/api/test_topics.py @@ -4,11 +4,18 @@ https://docs.gitlab.com/ce/api/topics.html """ -def test_topics(gl): +def test_topics(gl, gitlab_version): assert not gl.topics.list() - topic = gl.topics.create({"name": "my-topic", "description": "My Topic"}) + create_dict = {"name": "my-topic", "description": "My Topic"} + if gitlab_version.major >= 15: + create_dict["title"] = "my topic title" + topic = gl.topics.create( + {"name": "my-topic", "title": "my topic title", "description": "My Topic"} + ) assert topic.name == "my-topic" + if gitlab_version.major >= 15: + assert topic.title == "my topic title" assert gl.topics.list() topic.description = "My Updated Topic" diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py index 2767b9d..dc4422e 100644 --- a/tests/functional/conftest.py +++ b/tests/functional/conftest.py @@ -1,3 +1,4 @@ +import dataclasses import logging import tempfile import time @@ -12,6 +13,24 @@ import gitlab.base from tests.functional import helpers +@dataclasses.dataclass +class GitlabVersion: + major: int + minor: int + patch: str + revision: str + + def __post_init__(self): + self.major, self.minor = int(self.major), int(self.minor) + + +@pytest.fixture(scope="session") +def gitlab_version(gl) -> GitlabVersion: + version, revision = gl.version() + major, minor, patch = version.split(".") + return GitlabVersion(major=major, minor=minor, patch=patch, revision=revision) + + @pytest.fixture(scope="session") def fixture_dir(test_dir): return test_dir / "functional" / "fixtures" -- cgit v1.2.1 From b46b3791707ac76d501d6b7b829d1370925fd614 Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Thu, 28 Jul 2022 20:59:28 -0700 Subject: chore(clusters): deprecate clusters support Cluster support was deprecated in GitLab 14.5 [1]. And disabled by default in GitLab 15.0 [2] * Update docs to mark clusters as deprecated * Remove testing of clusters [1] https://docs.gitlab.com/ee/api/project_clusters.html [2] https://gitlab.com/groups/gitlab-org/configure/-/epics/8 --- tests/functional/api/test_clusters.py | 44 ----------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 tests/functional/api/test_clusters.py (limited to 'tests/functional') diff --git a/tests/functional/api/test_clusters.py b/tests/functional/api/test_clusters.py deleted file mode 100644 index 32d1488..0000000 --- a/tests/functional/api/test_clusters.py +++ /dev/null @@ -1,44 +0,0 @@ -def test_project_clusters(project): - cluster = project.clusters.create( - { - "name": "cluster1", - "platform_kubernetes_attributes": { - "api_url": "http://url", - "token": "tokenval", - }, - } - ) - clusters = project.clusters.list() - assert cluster in clusters - - cluster.platform_kubernetes_attributes = {"api_url": "http://newurl"} - cluster.save() - - cluster = project.clusters.list()[0] - assert cluster.platform_kubernetes["api_url"] == "http://newurl" - - cluster.delete() - assert cluster not in project.clusters.list() - - -def test_group_clusters(group): - cluster = group.clusters.create( - { - "name": "cluster1", - "platform_kubernetes_attributes": { - "api_url": "http://url", - "token": "tokenval", - }, - } - ) - clusters = group.clusters.list() - assert cluster in clusters - - cluster.platform_kubernetes_attributes = {"api_url": "http://newurl"} - cluster.save() - - cluster = group.clusters.list()[0] - assert cluster.platform_kubernetes["api_url"] == "http://newurl" - - cluster.delete() - assert cluster not in group.clusters.list() -- cgit v1.2.1