-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Bake enterprise version info into private cloud image (#2420)
* Bake enterprise version info into private cloud image * formatting
- Loading branch information
1 parent
bee68de
commit acebf93
Showing
7 changed files
with
66 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import pathlib | ||
|
||
from pytest_mock import MockerFixture | ||
|
||
from app.utils import get_version_info | ||
|
||
|
||
def test_get_version_info(mocker: MockerFixture) -> None: | ||
# Given | ||
mocked_pathlib = mocker.patch("app.utils.pathlib") | ||
|
||
def path_side_effect(file_path: str) -> mocker.MagicMock: | ||
mocked_path_object = mocker.MagicMock(spec=pathlib.Path) | ||
|
||
if file_path == "./ENTERPRISE_VERSION": | ||
mocked_path_object.exists.return_value = True | ||
|
||
return mocked_path_object | ||
|
||
mocked_pathlib.Path.side_effect = path_side_effect | ||
|
||
mock_get_file_contents = mocker.patch("app.utils._get_file_contents") | ||
mock_get_file_contents.side_effect = ("some_sha", "v1.0.0") | ||
|
||
# When | ||
result = get_version_info() | ||
|
||
# Then | ||
assert result == { | ||
"ci_commit_sha": "some_sha", | ||
"image_tag": "v1.0.0", | ||
"is_enterprise": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from django.urls import reverse | ||
from rest_framework import status | ||
from rest_framework.test import APIClient | ||
|
||
|
||
def test_get_version_info(api_client: APIClient) -> None: | ||
# Given | ||
url = reverse("version-info") | ||
|
||
# When | ||
response = api_client.get(url) | ||
|
||
# Then | ||
assert response.status_code == status.HTTP_200_OK | ||
assert response.json() == { | ||
"ci_commit_sha": "unknown", | ||
"image_tag": "unknown", | ||
"is_enterprise": False, | ||
} |
acebf93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
flagsmith-frontend-preview – ./frontend
flagsmith-frontend-production-native.vercel.app
flagsmith-frontend-preview-git-main-flagsmith.vercel.app
flagsmith-frontend-preview-flagsmith.vercel.app
acebf93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
docs – ./docs
docs-git-main-flagsmith.vercel.app
docs-flagsmith.vercel.app
docs.flagsmith.com
docs.bullet-train.io
acebf93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
flagsmith-frontend-staging – ./frontend
flagsmith-frontend-staging-flagsmith.vercel.app
flagsmith-staging-frontend.vercel.app
flagsmith-frontend-staging-git-main-flagsmith.vercel.app
staging.flagsmith.com