Skip to content

Add 30s cap time for tag tests #2141

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 7 commits into from
Feb 17, 2021
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
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def read_version():
"pytest<6.1.0",
"pytest-cov",
"pytest-rerunfailures",
"pytest-timeout",
"pytest-xdist",
"mock",
"contextlib2",
Expand Down
3 changes: 2 additions & 1 deletion tests/integ/sagemaker/lineage/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ def artifact_obj_with_association(sagemaker_session, artifact_obj):
@pytest.fixture
def trial_component_obj(sagemaker_session):
trial_component_obj = trial_component.TrialComponent.create(
trial_component_name=name(), sagemaker_boto_client=sagemaker_session.sagemaker_client
trial_component_name=name(),
sagemaker_boto_client=sagemaker_session.sagemaker_client,
)
yield trial_component_obj
time.sleep(0.5)
Expand Down
7 changes: 7 additions & 0 deletions tests/integ/sagemaker/lineage/test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

import datetime
import logging
import time

import pytest

from sagemaker.lineage import action

Expand Down Expand Up @@ -80,6 +83,7 @@ def test_list(action_objs, sagemaker_session):
assert action_names


@pytest.mark.timeout(30)
def test_tag(action_obj, sagemaker_session):
tag = {"Key": "foo", "Value": "bar"}
action_obj.set_tag(tag)
Expand All @@ -90,12 +94,14 @@ def test_tag(action_obj, sagemaker_session):
)["Tags"]
if actual_tags:
break
time.sleep(5)
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
# length of actual tags will be greater than 1
assert len(actual_tags) > 0
assert actual_tags[0] == tag


@pytest.mark.timeout(30)
def test_tags(action_obj, sagemaker_session):
tags = [{"Key": "foo1", "Value": "bar1"}]
action_obj.set_tags(tags)
Expand All @@ -106,6 +112,7 @@ def test_tags(action_obj, sagemaker_session):
)["Tags"]
if actual_tags:
break
time.sleep(5)
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
# length of actual tags will be greater than 1
assert len(actual_tags) > 0
Expand Down
6 changes: 6 additions & 0 deletions tests/integ/sagemaker/lineage/test_artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import logging
import time

import pytest

from sagemaker.lineage import artifact


Expand Down Expand Up @@ -111,6 +113,7 @@ def test_downstream_trials(trial_associated_artifact, trial_obj, sagemaker_sessi
assert trial_obj.trial_name in trials


@pytest.mark.timeout(30)
def test_tag(artifact_obj, sagemaker_session):
tag = {"Key": "foo", "Value": "bar"}
artifact_obj.set_tag(tag)
Expand All @@ -121,12 +124,14 @@ def test_tag(artifact_obj, sagemaker_session):
)["Tags"]
if actual_tags:
break
time.sleep(5)
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
# length of actual tags will be greater than 1
assert len(actual_tags) > 0
assert actual_tags[0] == tag


@pytest.mark.timeout(30)
def test_tags(artifact_obj, sagemaker_session):
tags = [{"Key": "foo1", "Value": "bar1"}]
artifact_obj.set_tags(tags)
Expand All @@ -137,6 +142,7 @@ def test_tags(artifact_obj, sagemaker_session):
)["Tags"]
if actual_tags:
break
time.sleep(5)
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
# length of actual tags will be greater than 1
assert len(actual_tags) > 0
Expand Down
8 changes: 6 additions & 2 deletions tests/integ/sagemaker/lineage/test_association.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import datetime
import time

import pytest

from sagemaker.lineage import association


Expand Down Expand Up @@ -55,6 +57,7 @@ def test_list(association_objs, sagemaker_session):
assert association_keys_listed


@pytest.mark.timeout(30)
def test_set_tag(association_obj, sagemaker_session):
tag = {"Key": "foo", "Value": "bar"}
association_obj.set_tag(tag)
Expand All @@ -65,13 +68,14 @@ def test_set_tag(association_obj, sagemaker_session):
)["Tags"]
if actual_tags:
break
time.sleep(1)
time.sleep(5)
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
# length of actual tags will be greater than 1
assert len(actual_tags) > 0
assert actual_tags[0] == tag


@pytest.mark.timeout(30)
def test_tags(association_obj, sagemaker_session):
tags = [{"Key": "foo1", "Value": "bar1"}]
association_obj.set_tags(tags)
Expand All @@ -82,7 +86,7 @@ def test_tags(association_obj, sagemaker_session):
)["Tags"]
if actual_tags:
break
time.sleep(1)
time.sleep(5)
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
# length of actual tags will be greater than 1
assert len(actual_tags) > 0
Expand Down
7 changes: 7 additions & 0 deletions tests/integ/sagemaker/lineage/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

import datetime
import logging
import time

import pytest

from sagemaker.lineage import context

Expand Down Expand Up @@ -78,6 +81,7 @@ def test_list(context_objs, sagemaker_session):
assert context_names


@pytest.mark.timeout(30)
def test_tag(context_obj, sagemaker_session):
tag = {"Key": "foo", "Value": "bar"}
context_obj.set_tag(tag)
Expand All @@ -88,12 +92,14 @@ def test_tag(context_obj, sagemaker_session):
)["Tags"]
if actual_tags:
break
time.sleep(5)
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
# length of actual tags will be greater than 1
assert len(actual_tags) > 0
assert actual_tags[0] == tag


@pytest.mark.timeout(30)
def test_tags(context_obj, sagemaker_session):
tags = [{"Key": "foo1", "Value": "bar1"}]
context_obj.set_tags(tags)
Expand All @@ -104,6 +110,7 @@ def test_tags(context_obj, sagemaker_session):
)["Tags"]
if actual_tags:
break
time.sleep(5)
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
# length of actual tags will be greater than 1
assert len(actual_tags) > 0
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ markers =
canary_quick
cron
local_mode
timeout: mark a test as a timeout.

[testenv]
passenv =
Expand Down