Skip to content

test(functional): bump GitLab docker image to 15.2.0-ee.0 #2194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api-objects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ API examples
gl_objects/emojis
gl_objects/badges
gl_objects/branches
gl_objects/clusters
gl_objects/messages
gl_objects/ci_lint
gl_objects/commits
Expand Down Expand Up @@ -63,3 +62,4 @@ API examples
gl_objects/variables
gl_objects/sidekiq
gl_objects/wikis
gl_objects/clusters
11 changes: 8 additions & 3 deletions docs/gl_objects/clusters.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
############
Clusters
############
#####################
Clusters (DEPRECATED)
#####################

.. warning::
Cluster support was deprecated in GitLab 14.5 and disabled by default as of
GitLab 15.0


Reference
---------
Expand Down
2 changes: 1 addition & 1 deletion docs/gl_objects/topics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Get a specific topic by its ID::

Create a new topic::

topic = gl.topics.create({"name": "my-topic"})
topic = gl.topics.create({"name": "my-topic", "title": "my title"})

Update a topic::

Expand Down
5 changes: 4 additions & 1 deletion gitlab/v4/objects/topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ class TopicManager(CRUDMixin, RESTManager):
_path = "/topics"
_obj_cls = Topic
_create_attrs = RequiredOptional(
required=("name",), optional=("avatar", "description")
# NOTE: The `title` field was added and is required in GitLab 15.0 or
# newer. But not present before that.
required=("name",),
optional=("avatar", "description", "title"),
)
_update_attrs = RequiredOptional(optional=("avatar", "description", "name"))
_types = {"avatar": types.ImageAttribute}
Expand Down
44 changes: 0 additions & 44 deletions tests/functional/api/test_clusters.py

This file was deleted.

11 changes: 9 additions & 2 deletions tests/functional/api/test_topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@
"""


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"
Comment on lines +10 to +18
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW I don't think we need to test multiple major versions as tests get complicated quickly, but I agree it'll be helpful having version checks when developing new features.

assert gl.topics.list()

topic.description = "My Updated Topic"
Expand Down
19 changes: 19 additions & 0 deletions tests/functional/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import dataclasses
import logging
import tempfile
import time
Expand All @@ -12,6 +13,24 @@
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"
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/fixtures/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
GITLAB_IMAGE=gitlab/gitlab-ee
GITLAB_TAG=14.9.2-ee.0
GITLAB_TAG=15.2.0-ee.0
5 changes: 4 additions & 1 deletion tests/unit/objects/test_topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
from gitlab.v4.objects import Topic

name = "GitLab"
topic_title = "topic title"
new_name = "gitlab-test"
topic_content = {
"id": 1,
"name": name,
"title": topic_title,
"description": "GitLab is an open source end-to-end software development platform.",
"total_projects_count": 1000,
"avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon",
Expand Down Expand Up @@ -102,9 +104,10 @@ def test_get_topic(gl, resp_get_topic):


def test_create_topic(gl, resp_create_topic):
topic = gl.topics.create({"name": name})
topic = gl.topics.create({"name": name, "title": topic_title})
assert isinstance(topic, Topic)
assert topic.name == name
assert topic.title == topic_title


def test_update_topic(gl, resp_update_topic):
Expand Down