Skip to content

Commit

Permalink
prepare 6.13.3 release (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaunchDarklyCI committed Feb 23, 2021
1 parent 881d1c3 commit f9ce3b9
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Expand Up @@ -66,7 +66,8 @@ jobs:
- run:
name: install requirements
command: |
sudo pip install --upgrade pip virtualenv;
sudo pip install --upgrade pip;
sudo pip install 'virtualenv~=16.0';
sudo pip install -r test-requirements.txt;
if [[ "<<parameters.filesource-supported>>" == "true" ]]; then
sudo pip install -r test-filesource-optional-requirements.txt;
Expand Down
3 changes: 2 additions & 1 deletion ldclient/event_processor.py
Expand Up @@ -3,6 +3,7 @@
"""
# currently excluded from documentation - see docs/README.md

from calendar import timegm
from collections import namedtuple
from email.utils import parsedate
import errno
Expand Down Expand Up @@ -368,7 +369,7 @@ def _handle_response(self, r):
if server_date_str is not None:
server_date = parsedate(server_date_str)
if server_date is not None:
timestamp = int(time.mktime(server_date) * 1000)
timestamp = int(timegm(server_date) * 1000)
self._last_known_past_time = timestamp
if r.status > 299 and not is_http_error_recoverable(r.status):
self._disabled = True
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -2,5 +2,5 @@ certifi>=2018.4.16
expiringdict>=1.1.4,<1.2.0
six>=1.10.0
pyRFC3339>=1.0
semver>=2.7.9
semver>=2.7.9,<3.0.0
urllib3>=1.22.0
2 changes: 1 addition & 1 deletion test-filesource-optional-requirements.txt
@@ -1,2 +1,2 @@
pyyaml>=3.0,<5.2
watchdog>=0.9
watchdog>=0.9,<1.0
6 changes: 3 additions & 3 deletions test-requirements.txt
@@ -1,9 +1,9 @@
mock>=2.0.0
pytest>=2.8
redis>=2.10.5
boto3>=1.9.71
redis>=2.10.5,<3.0.0
boto3>=1.9.71,<1.11.0
coverage>=4.4
jsonpickle==0.9.3
pytest-capturelog>=0.7
pytest-catchlog
pytest-cov>=2.4.0
codeclimate-test-reporter>=0.2.1
27 changes: 27 additions & 0 deletions testing/test_event_processor.py
Expand Up @@ -278,6 +278,33 @@ def test_event_can_be_both_tracked_and_debugged():
check_feature_event(output[2], e, True, user)
check_summary_event(output[3])

def test_debug_mode_does_not_expire_if_both_client_time_and_server_time_are_before_expiration_time():
with DefaultTestProcessor() as ep:
# Pick a server time that slightly different from client time
server_time = now() + 1000

# Send and flush an event we don't care about, just to set the last server time
mock_http.set_server_time(server_time)
ep.send_event({ 'kind': 'identify', 'user': { 'key': 'otherUser' }})
flush_and_get_events(ep)

# Now send an event with debug mode on, with a "debug until" time that is further in
# the future than both the client time and the server time
debug_until = server_time + 10000
e = {
'kind': 'feature', 'key': 'flagkey', 'version': 11, 'user': user,
'variation': 1, 'value': 'value', 'default': 'default',
'trackEvents': False, 'debugEventsUntilDate': debug_until
}
ep.send_event(e)

# Should get a summary event only, not a full feature event
output = flush_and_get_events(ep)
assert len(output) == 3
check_index_event(output[0], e, user)
check_feature_event(output[1], e, True, user) # debug event
check_summary_event(output[2])

def test_debug_mode_expires_based_on_client_time_if_client_time_is_later_than_server_time():
with DefaultTestProcessor() as ep:
# Pick a server time that is somewhat behind the client time
Expand Down

0 comments on commit f9ce3b9

Please sign in to comment.