Skip to content

Commit bf25b2a

Browse files
authored
Merge pull request #41 from bakdata/feature/error-handling
Feature/error handling
2 parents fd664b3 + 1e78fda commit bf25b2a

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ matrix:
1616
- name: R 3.6.0
1717
env: R_VERSION=3.6.0
1818
install:
19-
- PIPENV_VERBOSITY=-1 pipenv install --dev
19+
- pipenv install --dev
2020
script:
2121
- ./build.sh ${R_VERSION} && LOGLEVEL=INFO VERSION=${R_VERSION//\./_} pipenv run python -m unittest && if [ "$TRAVIS_BRANCH" = "master" ]; then ./integration_test.sh ${R_VERSION} ; fi
2222
deploy:
@@ -27,6 +27,7 @@ deploy:
2727
branch: master
2828
env:
2929
global:
30-
- AWS_DEFAULT_REGION: eu-central-1
30+
- AWS_DEFAULT_REGION=eu-central-1
31+
- PIPENV_VERBOSITY=-1
3132
- secure: lcvzavlau1syMM1uMZVSIHMUu8nGA9zN3KLqfJ4OiVVNEYxK0wrRtJKJyLCZM+SfEGoUkreLRLjEcQePDAV5+0A1xPEc+hnCWbDjAsl5Cj2t3ei76dKM5xwEAspMGaw+D1kwgWrreJXYzDvVDbgNc74XH49TpGMyKc4XGxFpvoixY5CjsYgigrvNn9OGfNjZkku99TRdxjBE14cmxtAwS3tMM5PL45Of4ZyrJ4Jl1Jeo5qncihNfHWDvSySb0MhdSBpYvXLPLffUS8tTurvwkRWEwcdPmjok04g+gKElvyEwUx1YmRvALBW7YdJ8Z58OaYIDhi7MGL6AM5fguPy+ldHy97zzVzhExIo5gdSM+IHVtjzPwTeICIT/Jh1OjbjN2wcnbV197LBdIHqSaaLibTuxlFwig6BFPq2hmWYu3ChtmheyVza8pZ9XTuutoWhO92uTvClJzI3cuD+pAFRKslnhIgClP5ifd1JA9HnzB/29bSGVwG5SD7dP11eTxfhXX44xfDkRPzs+GOTZH7Tc63AjuSayR7RM2IE//036LoRNRDZC4NCNrjKyBW2tROtR+BW06cY077kEmt2I4jEyHXb74ivsmD2JLSjCX5kf3oBI71zk/xWkM0NHV4ASVODzyyUShaYar+q2K/j4JqJQnATAMrwpK/yJopHMIa4Jx9A=
3233
- secure: GIVFD4H5E1Azi+41/lZqg3DX1dYu0oMaIOkr9GOY1UrzAmCgXRJ9A3P3b6UxGTltANy26jVROrDbeBhKrys5xUyPaUJTWV2oJEn8aMXbIQU9hQlxgRwJRLxBA1BkD6G59N52hlvV1K6p+jsrklHpB6NOvHrzH8Dsf17A9vtXb3FhPrDM+3aZIWNhib69w56kGqF9scJcBEAnjK9GAaz80jzwS620h3jn4gtft0gWKm80DB9wytBC/MuckfrMp9XkRKuRGFeFcgJaXRJzfd1Od4UnJCmbWdRB8bhHZUhW/0BtbgS+kjHm+zDAqqInYyx9Fv1dH1AeanLGxu3CsJJe5obNjeMtXKBKzTWf9n8IbLCi3jg050CVZ7zh2MP/gPZVdVvkmPAi1ZZDMwZhrAaLauZN9giFnOssE1lVkzZGmXgg24QWUFMh6x/ZKPj+krlb1V0aqoeTRwLHSupgrAj4q7qmkRFmxnb1RBeVrYvq8FnmV98dp8PsCNYvtaeqMK6A04WRA8hQwo+9nk/bTOpC9gzEGDZuMicpT6M0NIRsE0QCoYAreaWYz+ahBKBSprjwpQc8y+fBWGlWKT9Xs5eJvyrUVF5/2AJKYX/gUhfIMYrVKNZeub9iVksKl5xDbo/IS78M3r2/qLP+9SQQxvArsZ7ru1c52x+wY3sXMb6XQLM=

integration_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function integrationTest {
1818
sam package \
1919
--output-template-file packaged.yaml \
2020
--s3-bucket ${bucket} \
21-
--s3-prefix R-${version}/test \
21+
--s3-prefix R-${version} \
2222
--template-file test-template.yaml \
2323
--region ${region}
2424
version_="${version//\./_}"

tests/sam.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ def get_client(self):
7676
retries={'max_attempts': 0},
7777
)
7878
return boto3.client('lambda',
79-
region_name="eu-central-1",
8079
endpoint_url="http://{}:{}".format(self.host, self.port),
8180
use_ssl=False,
8281
verify=False,

tests/test_aws.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def setUpClass(cls):
2020
def get_client(self):
2121
return self.lambda_server.get_client() if is_local() else boto3.client('lambda')
2222

23-
@unittest.skipUnless(is_local(), "Only works locally")
23+
@unittest.skipUnless(is_local(), "Credentials missing for remote Lambda")
2424
def test_s3_get_object(self):
2525
lambda_client = self.get_client()
2626
response = lambda_client.invoke(FunctionName=get_function_name("AWSFunction"))

tests/test_runtime.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def test_missing_source_file(self):
9090
)
9191
raw_payload = response['Payload'].read().decode('utf-8')
9292
json_payload = json.loads(raw_payload)
93+
self.assertEqual('Unhandled', response['FunctionError'])
9394
self.assertIn('Source file does not exist: missing.[R|r]', json_payload['errorMessage'])
9495
self.assertEqual('simpleError', json_payload['errorType'])
9596

@@ -101,6 +102,7 @@ def test_missing_function(self):
101102
)
102103
raw_payload = response['Payload'].read().decode('utf-8')
103104
json_payload = json.loads(raw_payload)
105+
self.assertEqual('Unhandled', response['FunctionError'])
104106
self.assertIn('Function "handler_missing" does not exist', json_payload['errorMessage'])
105107
self.assertEqual('simpleError', json_payload['errorType'])
106108

@@ -112,6 +114,7 @@ def test_function_as_variable(self):
112114
)
113115
raw_payload = response['Payload'].read().decode('utf-8')
114116
json_payload = json.loads(raw_payload)
117+
self.assertEqual('Unhandled', response['FunctionError'])
115118
self.assertIn('Function "handler_as_variable" does not exist', json_payload['errorMessage'])
116119
self.assertEqual('simpleError', json_payload['errorType'])
117120

@@ -121,6 +124,7 @@ def test_missing_argument(self):
121124
response = lambda_client.invoke(FunctionName=get_function_name("ExampleFunction"))
122125
raw_payload = response['Payload'].read().decode('utf-8')
123126
json_payload = json.loads(raw_payload)
127+
self.assertEqual('Unhandled', response['FunctionError'])
124128
self.assertIn('argument "x" is missing, with no default', json_payload['errorMessage'])
125129
self.assertEqual('simpleError', json_payload['errorType'])
126130

@@ -132,6 +136,7 @@ def test_unused_argument(self):
132136
)
133137
raw_payload = response['Payload'].read().decode('utf-8')
134138
json_payload = json.loads(raw_payload)
139+
self.assertEqual('Unhandled', response['FunctionError'])
135140
self.assertIn('unused argument (y = 1)', json_payload['errorMessage'])
136141
self.assertEqual('simpleError', json_payload['errorType'])
137142

@@ -154,6 +159,7 @@ def test_missing_library(self):
154159
)
155160
raw_payload = response['Payload'].read().decode('utf-8')
156161
json_payload = json.loads(raw_payload)
162+
self.assertEqual('Unhandled', response['FunctionError'])
157163
self.assertIn('there is no package called ‘Matrix’', json_payload['errorMessage'])
158164
error_type = 'packageNotFoundError' if get_version() == '3_6_0' else 'simpleError'
159165
self.assertEqual(error_type, json_payload['errorType'])

0 commit comments

Comments
 (0)