Skip to content
Snippets Groups Projects
Verified Commit fe569ebd authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: timezone

parent 16ac853e
No related branches found
No related tags found
1 merge request!43BUG: setup timezone in deploy
Pipeline #27259 failed
......@@ -32,6 +32,7 @@ services:
- "10080:10080"
environment:
DEBUG: 1
DOCKER_TZ: "Cuba"
CAOSDB_CONFIG_AUTHTOKEN_CONFIG: "conf/core/authtoken.example.yaml"
CAOSDB_CONFIG_TRANSACTION_BENCHMARK_ENABLED: "TRUE"
CAOSDB_CONFIG__CAOSDB_INTEGRATION_TEST_SUITE_KEY: _CAOSDB_PYINTTEST_SUITE
......
......@@ -18,6 +18,8 @@ test_authentication.admin_token_crud = /authtoken/admin_token_crud.txt
test_authentication.admin_token_expired = /authtoken/admin_token_expired.txt
test_authentication.admin_token_3_attempts = /authtoken/admin_token_3_attempts.txt
; magic time zone of the server
test_misc.test_time_zone.time_zone = Cuba
[Connection]
url = https://caosdb-server:10443/
......
......@@ -28,8 +28,7 @@ import caosdb as db
from caosdb import (Container, Info, Property, Record, RecordType,
execute_query, administration as admin)
from caosdb.utils.register_tests import set_test_key, clear_database
from pytest import raises
from pytest import mark
from pytest import raises, mark, fixture
set_test_key("_CAOSDB_PYINTTEST_SUITE")
......@@ -422,3 +421,36 @@ def test_retrieve_wrong_role(clear_database):
"intialized with a wrong class by this client "
"or it has changed in the past and this "
"client did't know about it yet.")
@fixture
def reset_time_zone():
yield None
server_time_zone = db.get_config().get("IntegrationTests",
"test_misc.test_time_zone.time_zone")
if server_time_zone is not None:
admin.set_server_property("TIMEZONE", server_time_zone)
def test_time_zone(reset_time_zone):
server_time_zone = db.get_config().get("IntegrationTests",
"test_misc.test_time_zone.time_zone")
if server_time_zone is not None:
assert admin.get_server_property(
"TIMEZONE") == server_time_zone, "If this test fails locally, try to re-run it"
admin.set_server_property("TIMEZONE", "UTC")
assert db.Info().time_zone.offset == "+0000"
admin.set_server_property("TIMEZONE", "Etc/GMT+5") # Standard Time NY
gmt_plus_5 = db.Info().time_zone.offset
assert gmt_plus_5 == "-0500"
# Today I learned: POSIX defines GMT+X as UTC-X (... no words...)
admin.set_server_property("TIMEZONE", "EST")
assert db.Info().time_zone.offset == gmt_plus_5
admin.set_server_property("TIMEZONE", "Etc/GMT-1") # Standard Time Berlin
assert db.Info().time_zone.offset == "+0100"
admin.set_server_property("TIMEZONE", "Etc/GMT-14") # Kiritimati
assert db.Info().time_zone.offset == "+1400"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment