toil 6.1.0a1__py3-none-any.whl → 8.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- toil/__init__.py +122 -315
- toil/batchSystems/__init__.py +1 -0
- toil/batchSystems/abstractBatchSystem.py +173 -89
- toil/batchSystems/abstractGridEngineBatchSystem.py +272 -148
- toil/batchSystems/awsBatch.py +244 -135
- toil/batchSystems/cleanup_support.py +26 -16
- toil/batchSystems/contained_executor.py +31 -28
- toil/batchSystems/gridengine.py +86 -50
- toil/batchSystems/htcondor.py +166 -89
- toil/batchSystems/kubernetes.py +632 -382
- toil/batchSystems/local_support.py +20 -15
- toil/batchSystems/lsf.py +134 -81
- toil/batchSystems/lsfHelper.py +13 -11
- toil/batchSystems/mesos/__init__.py +41 -29
- toil/batchSystems/mesos/batchSystem.py +290 -151
- toil/batchSystems/mesos/executor.py +79 -50
- toil/batchSystems/mesos/test/__init__.py +31 -23
- toil/batchSystems/options.py +46 -28
- toil/batchSystems/registry.py +53 -19
- toil/batchSystems/singleMachine.py +296 -125
- toil/batchSystems/slurm.py +603 -138
- toil/batchSystems/torque.py +47 -33
- toil/bus.py +186 -76
- toil/common.py +664 -368
- toil/cwl/__init__.py +1 -1
- toil/cwl/cwltoil.py +1136 -483
- toil/cwl/utils.py +17 -22
- toil/deferred.py +63 -42
- toil/exceptions.py +5 -3
- toil/fileStores/__init__.py +5 -5
- toil/fileStores/abstractFileStore.py +140 -60
- toil/fileStores/cachingFileStore.py +717 -269
- toil/fileStores/nonCachingFileStore.py +116 -87
- toil/job.py +1225 -368
- toil/jobStores/abstractJobStore.py +416 -266
- toil/jobStores/aws/jobStore.py +863 -477
- toil/jobStores/aws/utils.py +201 -120
- toil/jobStores/conftest.py +3 -2
- toil/jobStores/fileJobStore.py +292 -154
- toil/jobStores/googleJobStore.py +140 -74
- toil/jobStores/utils.py +36 -15
- toil/leader.py +668 -272
- toil/lib/accelerators.py +115 -18
- toil/lib/aws/__init__.py +74 -31
- toil/lib/aws/ami.py +122 -87
- toil/lib/aws/iam.py +284 -108
- toil/lib/aws/s3.py +31 -0
- toil/lib/aws/session.py +214 -39
- toil/lib/aws/utils.py +287 -231
- toil/lib/bioio.py +13 -5
- toil/lib/compatibility.py +11 -6
- toil/lib/conversions.py +104 -47
- toil/lib/docker.py +131 -103
- toil/lib/ec2.py +361 -199
- toil/lib/ec2nodes.py +174 -106
- toil/lib/encryption/_dummy.py +5 -3
- toil/lib/encryption/_nacl.py +10 -6
- toil/lib/encryption/conftest.py +1 -0
- toil/lib/exceptions.py +26 -7
- toil/lib/expando.py +5 -3
- toil/lib/ftp_utils.py +217 -0
- toil/lib/generatedEC2Lists.py +127 -19
- toil/lib/humanize.py +6 -2
- toil/lib/integration.py +341 -0
- toil/lib/io.py +141 -15
- toil/lib/iterables.py +4 -2
- toil/lib/memoize.py +12 -8
- toil/lib/misc.py +66 -21
- toil/lib/objects.py +2 -2
- toil/lib/resources.py +68 -15
- toil/lib/retry.py +126 -81
- toil/lib/threading.py +299 -82
- toil/lib/throttle.py +16 -15
- toil/options/common.py +843 -409
- toil/options/cwl.py +175 -90
- toil/options/runner.py +50 -0
- toil/options/wdl.py +73 -17
- toil/provisioners/__init__.py +117 -46
- toil/provisioners/abstractProvisioner.py +332 -157
- toil/provisioners/aws/__init__.py +70 -33
- toil/provisioners/aws/awsProvisioner.py +1145 -715
- toil/provisioners/clusterScaler.py +541 -279
- toil/provisioners/gceProvisioner.py +282 -179
- toil/provisioners/node.py +155 -79
- toil/realtimeLogger.py +34 -22
- toil/resource.py +137 -75
- toil/server/app.py +128 -62
- toil/server/celery_app.py +3 -1
- toil/server/cli/wes_cwl_runner.py +82 -53
- toil/server/utils.py +54 -28
- toil/server/wes/abstract_backend.py +64 -26
- toil/server/wes/amazon_wes_utils.py +21 -15
- toil/server/wes/tasks.py +121 -63
- toil/server/wes/toil_backend.py +142 -107
- toil/server/wsgi_app.py +4 -3
- toil/serviceManager.py +58 -22
- toil/statsAndLogging.py +224 -70
- toil/test/__init__.py +282 -183
- toil/test/batchSystems/batchSystemTest.py +460 -210
- toil/test/batchSystems/batch_system_plugin_test.py +90 -0
- toil/test/batchSystems/test_gridengine.py +173 -0
- toil/test/batchSystems/test_lsf_helper.py +67 -58
- toil/test/batchSystems/test_slurm.py +110 -49
- toil/test/cactus/__init__.py +0 -0
- toil/test/cactus/test_cactus_integration.py +56 -0
- toil/test/cwl/cwlTest.py +496 -287
- toil/test/cwl/measure_default_memory.cwl +12 -0
- toil/test/cwl/not_run_required_input.cwl +29 -0
- toil/test/cwl/scatter_duplicate_outputs.cwl +40 -0
- toil/test/cwl/seqtk_seq.cwl +1 -1
- toil/test/docs/scriptsTest.py +69 -46
- toil/test/jobStores/jobStoreTest.py +427 -264
- toil/test/lib/aws/test_iam.py +118 -50
- toil/test/lib/aws/test_s3.py +16 -9
- toil/test/lib/aws/test_utils.py +5 -6
- toil/test/lib/dockerTest.py +118 -141
- toil/test/lib/test_conversions.py +113 -115
- toil/test/lib/test_ec2.py +58 -50
- toil/test/lib/test_integration.py +104 -0
- toil/test/lib/test_misc.py +12 -5
- toil/test/mesos/MesosDataStructuresTest.py +23 -10
- toil/test/mesos/helloWorld.py +7 -6
- toil/test/mesos/stress.py +25 -20
- toil/test/options/__init__.py +13 -0
- toil/test/options/options.py +42 -0
- toil/test/provisioners/aws/awsProvisionerTest.py +320 -150
- toil/test/provisioners/clusterScalerTest.py +440 -250
- toil/test/provisioners/clusterTest.py +166 -44
- toil/test/provisioners/gceProvisionerTest.py +174 -100
- toil/test/provisioners/provisionerTest.py +25 -13
- toil/test/provisioners/restartScript.py +5 -4
- toil/test/server/serverTest.py +188 -141
- toil/test/sort/restart_sort.py +137 -68
- toil/test/sort/sort.py +134 -66
- toil/test/sort/sortTest.py +91 -49
- toil/test/src/autoDeploymentTest.py +141 -101
- toil/test/src/busTest.py +20 -18
- toil/test/src/checkpointTest.py +8 -2
- toil/test/src/deferredFunctionTest.py +49 -35
- toil/test/src/dockerCheckTest.py +32 -24
- toil/test/src/environmentTest.py +135 -0
- toil/test/src/fileStoreTest.py +539 -272
- toil/test/src/helloWorldTest.py +7 -4
- toil/test/src/importExportFileTest.py +61 -31
- toil/test/src/jobDescriptionTest.py +46 -21
- toil/test/src/jobEncapsulationTest.py +2 -0
- toil/test/src/jobFileStoreTest.py +74 -50
- toil/test/src/jobServiceTest.py +187 -73
- toil/test/src/jobTest.py +121 -71
- toil/test/src/miscTests.py +19 -18
- toil/test/src/promisedRequirementTest.py +82 -36
- toil/test/src/promisesTest.py +7 -6
- toil/test/src/realtimeLoggerTest.py +10 -6
- toil/test/src/regularLogTest.py +71 -37
- toil/test/src/resourceTest.py +80 -49
- toil/test/src/restartDAGTest.py +36 -22
- toil/test/src/resumabilityTest.py +9 -2
- toil/test/src/retainTempDirTest.py +45 -14
- toil/test/src/systemTest.py +12 -8
- toil/test/src/threadingTest.py +44 -25
- toil/test/src/toilContextManagerTest.py +10 -7
- toil/test/src/userDefinedJobArgTypeTest.py +8 -5
- toil/test/src/workerTest.py +73 -23
- toil/test/utils/toilDebugTest.py +103 -33
- toil/test/utils/toilKillTest.py +4 -5
- toil/test/utils/utilsTest.py +245 -106
- toil/test/wdl/wdltoil_test.py +818 -149
- toil/test/wdl/wdltoil_test_kubernetes.py +91 -0
- toil/toilState.py +120 -35
- toil/utils/toilConfig.py +13 -4
- toil/utils/toilDebugFile.py +44 -27
- toil/utils/toilDebugJob.py +214 -27
- toil/utils/toilDestroyCluster.py +11 -6
- toil/utils/toilKill.py +8 -3
- toil/utils/toilLaunchCluster.py +256 -140
- toil/utils/toilMain.py +37 -16
- toil/utils/toilRsyncCluster.py +32 -14
- toil/utils/toilSshCluster.py +49 -22
- toil/utils/toilStats.py +356 -273
- toil/utils/toilStatus.py +292 -139
- toil/utils/toilUpdateEC2Instances.py +3 -1
- toil/version.py +12 -12
- toil/wdl/utils.py +5 -5
- toil/wdl/wdltoil.py +3913 -1033
- toil/worker.py +367 -184
- {toil-6.1.0a1.dist-info → toil-8.0.0.dist-info}/LICENSE +25 -0
- toil-8.0.0.dist-info/METADATA +173 -0
- toil-8.0.0.dist-info/RECORD +253 -0
- {toil-6.1.0a1.dist-info → toil-8.0.0.dist-info}/WHEEL +1 -1
- toil-6.1.0a1.dist-info/METADATA +0 -125
- toil-6.1.0a1.dist-info/RECORD +0 -237
- {toil-6.1.0a1.dist-info → toil-8.0.0.dist-info}/entry_points.txt +0 -0
- {toil-6.1.0a1.dist-info → toil-8.0.0.dist-info}/top_level.txt +0 -0
toil/test/lib/aws/test_iam.py
CHANGED
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
import json
|
|
15
15
|
import logging
|
|
16
|
+
from uuid import uuid4
|
|
16
17
|
|
|
17
18
|
import boto3
|
|
18
|
-
from moto import
|
|
19
|
+
from moto import mock_aws
|
|
19
20
|
|
|
20
21
|
from toil.lib.aws import iam
|
|
21
22
|
from toil.test import ToilTest
|
|
@@ -28,25 +29,47 @@ class IAMTest(ToilTest):
|
|
|
28
29
|
"""Check that given permissions and associated functions perform correctly"""
|
|
29
30
|
|
|
30
31
|
def test_permissions_iam(self):
|
|
31
|
-
granted_perms = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
assert
|
|
32
|
+
granted_perms = {
|
|
33
|
+
"*": {"Action": ["ec2:*", "iam:*", "s3:*", "sdb:*"], "NotAction": []}
|
|
34
|
+
}
|
|
35
|
+
assert (
|
|
36
|
+
iam.policy_permissions_allow(
|
|
37
|
+
granted_perms, iam.CLUSTER_LAUNCHING_PERMISSIONS
|
|
38
|
+
)
|
|
39
|
+
is True
|
|
40
|
+
)
|
|
41
|
+
granted_perms = {"*": {"Action": [], "NotAction": ["s3:*"]}}
|
|
42
|
+
assert (
|
|
43
|
+
iam.policy_permissions_allow(
|
|
44
|
+
granted_perms, iam.CLUSTER_LAUNCHING_PERMISSIONS
|
|
45
|
+
)
|
|
46
|
+
is True
|
|
47
|
+
)
|
|
35
48
|
|
|
36
49
|
def test_negative_permissions_iam(self):
|
|
37
|
-
granted_perms = {
|
|
38
|
-
assert
|
|
39
|
-
|
|
40
|
-
|
|
50
|
+
granted_perms = {"*": {"Action": ["ec2:*", "s3:*", "sdb:*"], "NotAction": []}}
|
|
51
|
+
assert (
|
|
52
|
+
iam.policy_permissions_allow(
|
|
53
|
+
granted_perms, iam.CLUSTER_LAUNCHING_PERMISSIONS
|
|
54
|
+
)
|
|
55
|
+
is False
|
|
56
|
+
)
|
|
57
|
+
granted_perms = {"*": {"Action": [], "NotAction": ["iam:*", "ec2:*"]}}
|
|
58
|
+
assert (
|
|
59
|
+
iam.policy_permissions_allow(
|
|
60
|
+
granted_perms, iam.CLUSTER_LAUNCHING_PERMISSIONS
|
|
61
|
+
)
|
|
62
|
+
is False
|
|
63
|
+
)
|
|
41
64
|
|
|
42
65
|
def test_wildcard_handling(self):
|
|
43
|
-
assert iam.permission_matches_any("iam:CreateRole", [
|
|
44
|
-
assert iam.permission_matches_any("iam:GetUser", [
|
|
45
|
-
assert iam.permission_matches_any("iam:ListRoleTags", [
|
|
66
|
+
assert iam.permission_matches_any("iam:CreateRole", ["iam:Create**"]) is True
|
|
67
|
+
assert iam.permission_matches_any("iam:GetUser", ["iam:???????"]) is True
|
|
68
|
+
assert iam.permission_matches_any("iam:ListRoleTags", ["iam:*?*Tags"]) is True
|
|
46
69
|
assert iam.permission_matches_any("iam:*", ["*"]) is True
|
|
47
|
-
assert iam.permission_matches_any("ec2:*", [
|
|
70
|
+
assert iam.permission_matches_any("ec2:*", ["iam:*"]) is False
|
|
48
71
|
|
|
49
|
-
@
|
|
72
|
+
@mock_aws
|
|
50
73
|
def test_get_policy_permissions(self):
|
|
51
74
|
mock_iam = boto3.client("iam")
|
|
52
75
|
|
|
@@ -55,68 +78,77 @@ class IAMTest(ToilTest):
|
|
|
55
78
|
mock_iam.create_user(UserName=user_name)
|
|
56
79
|
|
|
57
80
|
group_name = "default_group"
|
|
58
|
-
mock_iam.create_group(
|
|
59
|
-
GroupName=group_name
|
|
60
|
-
)
|
|
81
|
+
mock_iam.create_group(GroupName=group_name)
|
|
61
82
|
|
|
62
|
-
mock_iam.add_user_to_group(
|
|
63
|
-
GroupName=group_name,
|
|
64
|
-
UserName=user_name
|
|
65
|
-
)
|
|
83
|
+
mock_iam.add_user_to_group(GroupName=group_name, UserName=user_name)
|
|
66
84
|
|
|
67
85
|
policy_response = mock_iam.create_policy(
|
|
68
86
|
PolicyName="test_iam_createrole",
|
|
69
|
-
PolicyDocument=json.dumps(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
PolicyDocument=json.dumps(
|
|
88
|
+
{
|
|
89
|
+
"Version": "2012-10-17", # represents version language
|
|
90
|
+
"Statement": [
|
|
91
|
+
{"Effect": "Allow", "Action": "iam:CreateRole", "Resource": "*"}
|
|
92
|
+
],
|
|
93
|
+
}
|
|
94
|
+
),
|
|
75
95
|
)
|
|
76
96
|
# attached user policy
|
|
77
97
|
mock_iam.attach_user_policy(
|
|
78
|
-
UserName=user_name,
|
|
79
|
-
PolicyArn=policy_response["Policy"]["Arn"]
|
|
98
|
+
UserName=user_name, PolicyArn=policy_response["Policy"]["Arn"]
|
|
80
99
|
)
|
|
81
100
|
|
|
82
101
|
# inline user policy
|
|
83
102
|
mock_iam.put_user_policy(
|
|
84
103
|
UserName=user_name,
|
|
85
104
|
PolicyName="test_iam_createinstanceprofile",
|
|
86
|
-
PolicyDocument=json.dumps(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
105
|
+
PolicyDocument=json.dumps(
|
|
106
|
+
{
|
|
107
|
+
"Version": "2012-10-17", # represents version language
|
|
108
|
+
"Statement": [
|
|
109
|
+
{
|
|
110
|
+
"Effect": "Allow",
|
|
111
|
+
"Action": "iam:CreateInstanceProfile",
|
|
112
|
+
"Resource": "*",
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
}
|
|
116
|
+
),
|
|
92
117
|
)
|
|
93
118
|
|
|
94
119
|
# group policies
|
|
95
120
|
policy_response = mock_iam.create_policy(
|
|
96
121
|
PolicyName="test_iam_taginstanceprofile",
|
|
97
|
-
PolicyDocument=json.dumps(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
122
|
+
PolicyDocument=json.dumps(
|
|
123
|
+
{
|
|
124
|
+
"Version": "2012-10-17", # represents version language
|
|
125
|
+
"Statement": [
|
|
126
|
+
{
|
|
127
|
+
"Effect": "Allow",
|
|
128
|
+
"Action": "iam:TagInstanceProfile",
|
|
129
|
+
"Resource": "*",
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
}
|
|
133
|
+
),
|
|
103
134
|
)
|
|
104
135
|
# attached group policy
|
|
105
136
|
mock_iam.attach_group_policy(
|
|
106
|
-
GroupName=group_name,
|
|
107
|
-
PolicyArn=policy_response["Policy"]["Arn"]
|
|
137
|
+
GroupName=group_name, PolicyArn=policy_response["Policy"]["Arn"]
|
|
108
138
|
)
|
|
109
139
|
|
|
110
140
|
# inline group policy
|
|
111
141
|
mock_iam.put_group_policy(
|
|
112
142
|
GroupName=group_name,
|
|
113
143
|
PolicyName="test_iam_deleterole",
|
|
114
|
-
PolicyDocument=json.dumps(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
144
|
+
PolicyDocument=json.dumps(
|
|
145
|
+
{
|
|
146
|
+
"Version": "2012-10-17", # represents version language
|
|
147
|
+
"Statement": [
|
|
148
|
+
{"Effect": "Allow", "Action": "iam:DeleteRole", "Resource": "*"}
|
|
149
|
+
],
|
|
150
|
+
}
|
|
151
|
+
),
|
|
120
152
|
)
|
|
121
153
|
|
|
122
154
|
actions_collection = iam.get_policy_permissions("us-west-2")
|
|
@@ -124,6 +156,42 @@ class IAMTest(ToilTest):
|
|
|
124
156
|
actions_set = set(actions_collection["*"]["Action"])
|
|
125
157
|
notactions_set = set(actions_collection["*"]["NotAction"])
|
|
126
158
|
|
|
127
|
-
expected_actions = {
|
|
159
|
+
expected_actions = {
|
|
160
|
+
"iam:CreateRole",
|
|
161
|
+
"iam:CreateInstanceProfile",
|
|
162
|
+
"iam:TagInstanceProfile",
|
|
163
|
+
"iam:DeleteRole",
|
|
164
|
+
}
|
|
128
165
|
assert actions_set == expected_actions
|
|
129
166
|
assert notactions_set == set()
|
|
167
|
+
|
|
168
|
+
def test_create_delete_iam_role(self):
|
|
169
|
+
region = "us-west-2"
|
|
170
|
+
role_name = f'test{str(uuid4()).replace("-", "")}'
|
|
171
|
+
with self.subTest("Create role w/policies."):
|
|
172
|
+
ec2_role_policy_document = json.dumps(
|
|
173
|
+
{
|
|
174
|
+
"Version": "2012-10-17",
|
|
175
|
+
"Statement": [
|
|
176
|
+
{
|
|
177
|
+
"Effect": "Allow",
|
|
178
|
+
"Principal": {"Service": ["ec2.amazonaws.com"]},
|
|
179
|
+
"Action": ["sts:AssumeRole"],
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
policy = dict(
|
|
185
|
+
s3_deny=dict(
|
|
186
|
+
Version="2012-10-17",
|
|
187
|
+
Statement=[dict(Effect="Deny", Resource="*", Action="s3:*")],
|
|
188
|
+
)
|
|
189
|
+
)
|
|
190
|
+
iam.create_iam_role(
|
|
191
|
+
role_name=role_name,
|
|
192
|
+
assume_role_policy_document=ec2_role_policy_document,
|
|
193
|
+
policies=policy,
|
|
194
|
+
region=region,
|
|
195
|
+
)
|
|
196
|
+
with self.subTest("Delete role w/policies."):
|
|
197
|
+
iam.delete_iam_role(role_name=role_name, region=region)
|
toil/test/lib/aws/test_s3.py
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import logging
|
|
15
15
|
import os
|
|
16
16
|
import uuid
|
|
17
|
-
from typing import Optional
|
|
17
|
+
from typing import TYPE_CHECKING, Optional
|
|
18
18
|
|
|
19
19
|
from toil.jobStores.aws.jobStore import AWSJobStore
|
|
20
20
|
from toil.lib.aws.session import establish_boto3_session
|
|
@@ -29,11 +29,12 @@ logging.basicConfig(level=logging.DEBUG)
|
|
|
29
29
|
class S3Test(ToilTest):
|
|
30
30
|
"""Confirm the workarounds for us-east-1."""
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
if TYPE_CHECKING:
|
|
33
|
+
from mypy_boto3_s3 import S3ServiceResource
|
|
34
|
+
from mypy_boto3_s3.service_resource import Bucket
|
|
34
35
|
|
|
35
|
-
s3_resource: Optional[S3ServiceResource]
|
|
36
|
-
bucket: Optional[Bucket]
|
|
36
|
+
s3_resource: Optional["S3ServiceResource"]
|
|
37
|
+
bucket: Optional["Bucket"]
|
|
37
38
|
|
|
38
39
|
@classmethod
|
|
39
40
|
def setUpClass(cls) -> None:
|
|
@@ -57,16 +58,22 @@ class S3Test(ToilTest):
|
|
|
57
58
|
self.assertEqual(get_bucket_region(bucket_name), "us-east-1")
|
|
58
59
|
|
|
59
60
|
# Make sure all the bucket location getting strategies work on a bucket we created
|
|
60
|
-
self.assertEqual(
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
self.assertEqual(
|
|
62
|
+
get_bucket_region(bucket_name, only_strategies={1}), "us-east-1"
|
|
63
|
+
)
|
|
64
|
+
self.assertEqual(
|
|
65
|
+
get_bucket_region(bucket_name, only_strategies={2}), "us-east-1"
|
|
66
|
+
)
|
|
67
|
+
self.assertEqual(
|
|
68
|
+
get_bucket_region(bucket_name, only_strategies={3}), "us-east-1"
|
|
69
|
+
)
|
|
63
70
|
|
|
64
71
|
def test_get_bucket_location_public_bucket(self) -> None:
|
|
65
72
|
"""
|
|
66
73
|
Test getting buket location for a bucket we don't own.
|
|
67
74
|
"""
|
|
68
75
|
|
|
69
|
-
bucket_name =
|
|
76
|
+
bucket_name = "spacenet-dataset"
|
|
70
77
|
# This bucket happens to live in us-east-1
|
|
71
78
|
self.assertEqual(get_bucket_region(bucket_name), "us-east-1")
|
|
72
79
|
|
toil/test/lib/aws/test_utils.py
CHANGED
|
@@ -21,23 +21,25 @@ from toil.test import ToilTest
|
|
|
21
21
|
logger = logging.getLogger(__name__)
|
|
22
22
|
logging.basicConfig(level=logging.DEBUG)
|
|
23
23
|
|
|
24
|
+
|
|
24
25
|
class TagGenerationTest(ToilTest):
|
|
25
26
|
"""
|
|
26
27
|
Test for tag generation from environment variables
|
|
27
28
|
"""
|
|
29
|
+
|
|
28
30
|
def test_build_tag(self):
|
|
29
31
|
environment = dict()
|
|
30
32
|
environment["TOIL_OWNER_TAG"] = "😀"
|
|
31
33
|
environment["TOIL_AWS_TAGS"] = None
|
|
32
34
|
tag_dict = build_tag_dict_from_env(environment)
|
|
33
|
-
assert
|
|
35
|
+
assert tag_dict == {"Owner": "😀"}
|
|
34
36
|
|
|
35
37
|
def test_empty_aws_tags(self):
|
|
36
38
|
environment = dict()
|
|
37
39
|
environment["TOIL_OWNER_TAG"] = None
|
|
38
40
|
environment["TOIL_AWS_TAGS"] = "{}"
|
|
39
41
|
tag_dict = build_tag_dict_from_env(environment)
|
|
40
|
-
assert
|
|
42
|
+
assert tag_dict == dict()
|
|
41
43
|
|
|
42
44
|
def test_incorrect_json_object(self):
|
|
43
45
|
with pytest.raises(SystemExit):
|
|
@@ -58,7 +60,4 @@ class TagGenerationTest(ToilTest):
|
|
|
58
60
|
environment["TOIL_OWNER_TAG"] = "😀"
|
|
59
61
|
environment["TOIL_AWS_TAGS"] = '{"1": "2", " ":")"}'
|
|
60
62
|
tag_dict = build_tag_dict_from_env(environment)
|
|
61
|
-
assert
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
assert tag_dict == {"Owner": "😀", "1": "2", " ": ")"}
|