-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
195 additions
and
17 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
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,15 @@ | ||
from cratedb_toolkit.util.platform import PlatformInfo | ||
|
||
|
||
def test_platforminfo_application(): | ||
pi = PlatformInfo() | ||
outcome = pi.application() | ||
assert "name" in outcome | ||
assert "version" in outcome | ||
assert "platform" in outcome | ||
|
||
|
||
def test_platforminfo_libraries(): | ||
pi = PlatformInfo() | ||
outcome = pi.libraries() | ||
assert isinstance(outcome, dict) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import datetime as dt | ||
import os | ||
|
||
import pytest | ||
|
||
pytest.importorskip("fastapi") | ||
|
||
|
||
from fastapi.testclient import TestClient | ||
|
||
from cratedb_toolkit import __appname__, __version__ | ||
from cratedb_toolkit.wtf.http import app | ||
|
||
client = TestClient(app) | ||
|
||
|
||
def test_http_root(): | ||
response = client.get("/") | ||
data = response.json() | ||
assert response.status_code == 200 | ||
assert data["application_name"] == __appname__ | ||
assert data["application_version"].startswith(__version__) | ||
assert dt.datetime.fromisoformat(data["system_time"]).year == dt.datetime.now().year | ||
|
||
|
||
def test_http_info(cratedb, mocker): | ||
mocker.patch.dict(os.environ, {"CRATEDB_SQLALCHEMY_URL": cratedb.database.dburi}) | ||
|
||
response = client.get("/info/all") | ||
info = response.json() | ||
assert response.status_code == 200 | ||
|
||
assert info["meta"]["application_name"] == __appname__ | ||
assert info["meta"]["application_version"].startswith(__version__) | ||
assert dt.datetime.fromisoformat(info["meta"]["system_time"]).year == dt.datetime.now().year | ||
assert "elements" in info["meta"] | ||
assert len(info["meta"]["elements"]) > 15 | ||
|
||
assert "data" in info | ||
assert info["data"]["database"]["cluster_nodes_count"] == 1 | ||
assert info["data"]["system"]["application"]["name"] == __appname__ | ||
|
||
assert "eco" in info["data"]["system"] |