Git Product home page Git Product logo

Comments (10)

patrickherring-TRI avatar patrickherring-TRI commented on July 19, 2024 1

Yeah, definitely, I just wanted to confirm the issue. I think that we can solve this by testing the connection earlier in the test and skipping if the credentials are not correct. Long term we will fix this with a refactor to remove these components.

from beep.

patrickherring-TRI avatar patrickherring-TRI commented on July 19, 2024

I think this might actually be due to having an existing AWS account. Could you actually try to run these tests without an internet connection? In my testing, I was able to complete all tests successfully if I turned off all AWS access.

from beep.

tinosulzer avatar tinosulzer commented on July 19, 2024

Yes, running without an internet connection worked (skipped 13 tests). Do you think it's possible to fix so that it works with an internet connection? Having to wait 15 minutes without internet for all the tests to run is not ideal

from beep.

chirranjeevigopal-TRI avatar chirranjeevigopal-TRI commented on July 19, 2024

@tinosulzer just merged a PR that defaults tests to 'events_off' mode if the right aws secret is not accessible. Test it and let me know if this works. Almost there...

from beep.

tinosulzer avatar tinosulzer commented on July 19, 2024

It's better, but still got some errors:

Ran 96 tests in 627.969s

FAILED (SKIP=3, errors=9)

The output is too long to see everything but mostly the same errors about secrets

from beep.

patrickherring-TRI avatar patrickherring-TRI commented on July 19, 2024

I have been trying to replicate your issue by cloning the repo to various environments and running the tests. So far I have not been able to replicate the problem. Could you let me know which tests are still failing?

from beep.

tinosulzer avatar tinosulzer commented on July 19, 2024

Here's a representative error message:

======================================================================
ERROR: test_kinesis_put_validation_event (test_events.KinesisEventsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/vsulzer/Documents/Energy_storage/BEEP/beep/tests/test_events.py", line 114, in test_kinesis_put_validation_event
    events = KinesisEvents(service='Testing', mode='test')
  File "/Users/vsulzer/Documents/Energy_storage/BEEP/beep/utils/events.py", line 85, in __init__
    self.stream = get_secret(config['test']['kinesis']['stream'])['streamName']
  File "/Users/vsulzer/Documents/Energy_storage/BEEP/beep/utils/secrets_manager.py", line 59, in get_secret
    raise e
  File "/Users/vsulzer/Documents/Energy_storage/BEEP/beep/utils/secrets_manager.py", line 56, in get_secret
    SecretId=secret_name
  File "/Users/vsulzer/Documents/Energy_storage/BEEP/venv/lib/python3.7/site-packages/botocore/client.py", line 316, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/vsulzer/Documents/Energy_storage/BEEP/venv/lib/python3.7/site-packages/botocore/client.py", line 626, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the GetSecretValue operation: Secrets Manager can't find the specified secret.
-------------------- >> begin captured logging << --------------------
botocore.hooks: DEBUG: Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
botocore.hooks: DEBUG: Changing event name from before-call.apigateway to before-call.api-gateway
botocore.hooks: DEBUG: Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
botocore.hooks: DEBUG: Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
botocore.hooks: DEBUG: Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
botocore.hooks: DEBUG: Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
botocore.hooks: DEBUG: Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
botocore.hooks: DEBUG: Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
botocore.hooks: DEBUG: Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
botocore.hooks: DEBUG: Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
botocore.hooks: DEBUG: Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
botocore.credentials: DEBUG: Looking for credentials via: env
botocore.credentials: DEBUG: Looking for credentials via: assume-role
botocore.credentials: DEBUG: Looking for credentials via: assume-role-with-web-identity
botocore.credentials: DEBUG: Looking for credentials via: shared-credentials-file
botocore.credentials: INFO: Found credentials in shared credentials file: ~/.aws/credentials
botocore.loaders: DEBUG: Loading JSON file: /Users/vsulzer/Documents/Energy_storage/BEEP/venv/lib/python3.7/site-packages/botocore/data/endpoints.json
botocore.hooks: DEBUG: Event choose-service-name: calling handler <function handle_service_name_alias at 0x11466c830>
botocore.loaders: DEBUG: Loading JSON file: /Users/vsulzer/Documents/Energy_storage/BEEP/venv/lib/python3.7/site-packages/botocore/data/secretsmanager/2017-10-17/service-2.json
botocore.loaders: DEBUG: Loading JSON file: /Users/vsulzer/Documents/Energy_storage/BEEP/venv/lib/python3.7/site-packages/botocore/data/secretsmanager/2017-10-17/service-2.sdk-extras.json
botocore.hooks: DEBUG: Event creating-client-class.secrets-manager: calling handler <function add_generate_presigned_url at 0x11463b440>
botocore.endpoint: DEBUG: Setting secretsmanager timeout as (60, 60)
botocore.loaders: DEBUG: Loading JSON file: /Users/vsulzer/Documents/Energy_storage/BEEP/venv/lib/python3.7/site-packages/botocore/data/_retry.json
botocore.client: DEBUG: Registering retry handlers for service: secretsmanager
botocore.hooks: DEBUG: Event before-parameter-build.secrets-manager.GetSecretValue: calling handler <function generate_idempotent_uuid at 0x11469ae60>
botocore.hooks: DEBUG: Event before-call.secrets-manager.GetSecretValue: calling handler <function inject_api_version_header_if_needed at 0x1146a4950>
botocore.endpoint: DEBUG: Making request for OperationModel(name=GetSecretValue) with params: {'url_path': '/', 'query_string': '', 'method': 'POST', 'headers': {'X-Amz-Target': 'secretsmanager.GetSecretValue', 'Content-Type': 'application/x-amz-json-1.1', 'User-Agent': 'Boto3/1.12.4 Python/3.7.7 Darwin/19.4.0 Botocore/1.15.4'}, 'body': b'{"SecretId": "local/beep/eventstream"}', 'url': 'https://secretsmanager.us-west-2.amazonaws.com/', 'context': {'client_region': 'us-west-2', 'client_config': <botocore.config.Config object at 0x130356890>, 'has_streaming_input': False, 'auth_type': None}}
botocore.hooks: DEBUG: Event request-created.secrets-manager.GetSecretValue: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x130356810>>
botocore.hooks: DEBUG: Event choose-signer.secrets-manager.GetSecretValue: calling handler <function set_operation_specific_signer at 0x11469a3b0>
botocore.auth: DEBUG: Calculating signature using v4 auth.
botocore.auth: DEBUG: CanonicalRequest:
POST
/

content-type:application/x-amz-json-1.1
host:secretsmanager.us-west-2.amazonaws.com
x-amz-date:20200611T141439Z
x-amz-target:secretsmanager.GetSecretValue

content-type;host;x-amz-date;x-amz-target
c5763faee03d0d8a3d28e22207a85ed8cd6db3208b6b5007b772485712bb1914
botocore.auth: DEBUG: StringToSign:
AWS4-HMAC-SHA256
20200611T141439Z
20200611/us-west-2/secretsmanager/aws4_request
ee66a84bbee64a410509d317e8c601fc63f917438fc4887b26362544f94d10c7
botocore.auth: DEBUG: Signature:
934acabca2a197515488610c7198d938202b89351d9cead42c1f9447ba2459c4
botocore.endpoint: DEBUG: Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://secretsmanager.us-west-2.amazonaws.com/, headers={'X-Amz-Target': b'secretsmanager.GetSecretValue', 'Content-Type': b'application/x-amz-json-1.1', 'User-Agent': b'Boto3/1.12.4 Python/3.7.7 Darwin/19.4.0 Botocore/1.15.4', 'X-Amz-Date': b'20200611T141439Z', 'Authorization': b'AWS4-HMAC-SHA256 Credential=AKIARMITENQXCCNA6LEU/20200611/us-west-2/secretsmanager/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=934acabca2a197515488610c7198d938202b89351d9cead42c1f9447ba2459c4', 'Content-Length': '38'}>
urllib3.connectionpool: DEBUG: Starting new HTTPS connection (1): secretsmanager.us-west-2.amazonaws.com:443
urllib3.connectionpool: DEBUG: https://secretsmanager.us-west-2.amazonaws.com:443 "POST / HTTP/1.1" 400 99
botocore.parsers: DEBUG: Response headers: {'Date': 'Thu, 11 Jun 2020 14:14:40 GMT', 'Content-Type': 'application/x-amz-json-1.1', 'Content-Length': '99', 'Connection': 'keep-alive', 'x-amzn-RequestId': '611daed9-6df9-4a2e-a13e-e4ab05ed997c'}
botocore.parsers: DEBUG: Response body:
b'{"__type":"ResourceNotFoundException","Message":"Secrets Manager can\'t find the specified secret."}'
botocore.hooks: DEBUG: Event needs-retry.secrets-manager.GetSecretValue: calling handler <botocore.retryhandler.RetryHandler object at 0x130356bd0>
botocore.retryhandler: DEBUG: No retry needed.
botocore.hooks: DEBUG: Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
botocore.hooks: DEBUG: Changing event name from before-call.apigateway to before-call.api-gateway
botocore.hooks: DEBUG: Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
botocore.hooks: DEBUG: Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
botocore.hooks: DEBUG: Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
botocore.hooks: DEBUG: Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
botocore.hooks: DEBUG: Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
botocore.hooks: DEBUG: Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
botocore.hooks: DEBUG: Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
botocore.hooks: DEBUG: Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
botocore.hooks: DEBUG: Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
botocore.credentials: DEBUG: Looking for credentials via: env
botocore.credentials: DEBUG: Looking for credentials via: assume-role
botocore.credentials: DEBUG: Looking for credentials via: assume-role-with-web-identity
botocore.credentials: DEBUG: Looking for credentials via: shared-credentials-file
botocore.credentials: INFO: Found credentials in shared credentials file: ~/.aws/credentials
botocore.loaders: DEBUG: Loading JSON file: /Users/vsulzer/Documents/Energy_storage/BEEP/venv/lib/python3.7/site-packages/botocore/data/endpoints.json
botocore.hooks: DEBUG: Event choose-service-name: calling handler <function handle_service_name_alias at 0x11466c830>
botocore.loaders: DEBUG: Loading JSON file: /Users/vsulzer/Documents/Energy_storage/BEEP/venv/lib/python3.7/site-packages/botocore/data/secretsmanager/2017-10-17/service-2.json
botocore.loaders: DEBUG: Loading JSON file: /Users/vsulzer/Documents/Energy_storage/BEEP/venv/lib/python3.7/site-packages/botocore/data/secretsmanager/2017-10-17/service-2.sdk-extras.json
botocore.hooks: DEBUG: Event creating-client-class.secrets-manager: calling handler <function add_generate_presigned_url at 0x11463b440>
botocore.endpoint: DEBUG: Setting secretsmanager timeout as (60, 60)
botocore.loaders: DEBUG: Loading JSON file: /Users/vsulzer/Documents/Energy_storage/BEEP/venv/lib/python3.7/site-packages/botocore/data/_retry.json
botocore.client: DEBUG: Registering retry handlers for service: secretsmanager
botocore.hooks: DEBUG: Event before-parameter-build.secrets-manager.GetSecretValue: calling handler <function generate_idempotent_uuid at 0x11469ae60>
botocore.hooks: DEBUG: Event before-call.secrets-manager.GetSecretValue: calling handler <function inject_api_version_header_if_needed at 0x1146a4950>
botocore.endpoint: DEBUG: Making request for OperationModel(name=GetSecretValue) with params: {'url_path': '/', 'query_string': '', 'method': 'POST', 'headers': {'X-Amz-Target': 'secretsmanager.GetSecretValue', 'Content-Type': 'application/x-amz-json-1.1', 'User-Agent': 'Boto3/1.12.4 Python/3.7.7 Darwin/19.4.0 Botocore/1.15.4'}, 'body': b'{"SecretId": "local/beep/eventstream"}', 'url': 'https://secretsmanager.us-west-2.amazonaws.com/', 'context': {'client_region': 'us-west-2', 'client_config': <botocore.config.Config object at 0x13097f650>, 'has_streaming_input': False, 'auth_type': None}}
botocore.hooks: DEBUG: Event request-created.secrets-manager.GetSecretValue: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x13097f5d0>>
botocore.hooks: DEBUG: Event choose-signer.secrets-manager.GetSecretValue: calling handler <function set_operation_specific_signer at 0x11469a3b0>
botocore.auth: DEBUG: Calculating signature using v4 auth.
botocore.auth: DEBUG: CanonicalRequest:
POST
/

content-type:application/x-amz-json-1.1
host:secretsmanager.us-west-2.amazonaws.com
x-amz-date:20200611T141440Z
x-amz-target:secretsmanager.GetSecretValue

content-type;host;x-amz-date;x-amz-target
c5763faee03d0d8a3d28e22207a85ed8cd6db3208b6b5007b772485712bb1914
botocore.auth: DEBUG: StringToSign:
AWS4-HMAC-SHA256
20200611T141440Z
20200611/us-west-2/secretsmanager/aws4_request
bc2352951f978b9ac23f94cec279bfa2f1d6974b3c1225b8e829e39d7a6cc91f
botocore.auth: DEBUG: Signature:
1153f1040b6c5643ce248cdcae249cc4c93f7abfb6f02c35f67ec4eb4e8b2ddf
botocore.endpoint: DEBUG: Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://secretsmanager.us-west-2.amazonaws.com/, headers={'X-Amz-Target': b'secretsmanager.GetSecretValue', 'Content-Type': b'application/x-amz-json-1.1', 'User-Agent': b'Boto3/1.12.4 Python/3.7.7 Darwin/19.4.0 Botocore/1.15.4', 'X-Amz-Date': b'20200611T141440Z', 'Authorization': b'AWS4-HMAC-SHA256 Credential=AKIARMITENQXCCNA6LEU/20200611/us-west-2/secretsmanager/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=1153f1040b6c5643ce248cdcae249cc4c93f7abfb6f02c35f67ec4eb4e8b2ddf', 'Content-Length': '38'}>
urllib3.connectionpool: DEBUG: Starting new HTTPS connection (1): secretsmanager.us-west-2.amazonaws.com:443
urllib3.connectionpool: DEBUG: https://secretsmanager.us-west-2.amazonaws.com:443 "POST / HTTP/1.1" 400 99
botocore.parsers: DEBUG: Response headers: {'Date': 'Thu, 11 Jun 2020 14:14:41 GMT', 'Content-Type': 'application/x-amz-json-1.1', 'Content-Length': '99', 'Connection': 'keep-alive', 'x-amzn-RequestId': '2a93a1b9-166a-400a-a73c-7520432576b0'}
botocore.parsers: DEBUG: Response body:
b'{"__type":"ResourceNotFoundException","Message":"Secrets Manager can\'t find the specified secret."}'
botocore.hooks: DEBUG: Event needs-retry.secrets-manager.GetSecretValue: calling handler <botocore.retryhandler.RetryHandler object at 0x13097f990>
botocore.retryhandler: DEBUG: No retry needed.
--------------------- >> end captured logging << ---------------------

from beep.

tinosulzer avatar tinosulzer commented on July 19, 2024

All 9 errors are coming from test_events.py. By the way, if you add these lines to the bottom of test files you can run each test file individually:

if __name__ == "__main__":
    ## OPTIONAL ######
    print("Add -v for more debug output")
    import sys

    if "-v" in sys.argv:
        debug = True
    #################
    unittest.main()

(maybe you already have a different way of doing this)

from beep.

patrickherring-TRI avatar patrickherring-TRI commented on July 19, 2024

Thanks! I think if the failures are occuring in test_events.py I have some idea of how to fix them.

Thanks for the tip! For testing I have been using nose so something like:
nosetests beep/tests/test_events.py:KinesisEventsTest --nologcapture
in order to run a single set of tests. Is that the functionality you are referring to?

from beep.

tinosulzer avatar tinosulzer commented on July 19, 2024

Ah nice, that works too, didn't know you could do this

from beep.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.