Skip to content
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

KeyError: 'THOTH_BACKEND_NAMESPACE' #301

Closed
bissenbay opened this issue Oct 5, 2020 · 4 comments
Closed

KeyError: 'THOTH_BACKEND_NAMESPACE' #301

bissenbay opened this issue Oct 5, 2020 · 4 comments

Comments

@bissenbay
Copy link
Contributor

I run Scenario: Run a simple thamos advise for a flask application for raw HTTP connection in integration-tests and see that adviser job fails, in the logs I see the error below:

{"name": "thoth.common", "levelname": "WARNING", "module": "logging", "lineno": 344, "funcname": "init_logging", "created": 1601856578.845984, "asctime": "2020-10-05 00:09:38,845", "msecs": 845.9839820861816, "relative_created": 9202.311754226685, "process": 1, "message": "Logging to a Sentry instance is turned off"}
Traceback (most recent call last):
  File "/opt/app-root/bin/faust", line 8, in <module>
    sys.exit(cli())
  File "/opt/app-root/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/opt/app-root/lib/python3.6/site-packages/click/core.py", line 781, in main
    with self.make_context(prog_name, args, **extra) as ctx:
  File "/opt/app-root/lib/python3.6/site-packages/faust/cli/base.py", line 407, in make_context
    self._maybe_import_app()
  File "/opt/app-root/lib/python3.6/site-packages/faust/cli/base.py", line 372, in _maybe_import_app
    find_app(appstr)
  File "/opt/app-root/lib/python3.6/site-packages/faust/cli/base.py", line 299, in find_app
    val = symbol_by_name(app, imp=imp)
  File "/opt/app-root/lib/python3.6/site-packages/mode/utils/imports.py", line 269, in symbol_by_name
    **kwargs)
  File "/opt/app-root/lib/python3.6/site-packages/mode/utils/imports.py", line 376, in import_from_cwd
    return imp(module, package=package)
  File "/opt/app-root/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/app-root/src/producer.py", line 26, in <module>
    from investigator.investigator.unresolved_package import investigate_unresolved_package
  File "/opt/app-root/src/investigator/investigator/unresolved_package/__init__.py", line 20, in <module>
    from .investigate_unresolved_package import parse_unresolved_package_message
  File "/opt/app-root/src/investigator/investigator/unresolved_package/investigate_unresolved_package.py", line 36, in <module>
    from .. import common
  File "/opt/app-root/src/investigator/investigator/common.py", line 33, in <module>
    from .configuration import Configuration
  File "/opt/app-root/src/investigator/investigator/configuration.py", line 28, in <module>
    class Configuration:
  File "/opt/app-root/src/investigator/investigator/configuration.py", line 32, in Configuration
    THOTH_BACKEND_NAMESPACE = os.environ["THOTH_BACKEND_NAMESPACE"]
  File "/opt/app-root/lib64/python3.6/os.py", line 669, in __getitem__
    raise KeyError(key) from None
KeyError: 'THOTH_BACKEND_NAMESPACE'
@bissenbay bissenbay transferred this issue from thoth-station/thoth-application Oct 5, 2020
@pacospace
Copy link
Contributor

pacospace commented Oct 5, 2020

  • is this test or stage?
  • what are the versions of the components used when running integration test?

@pacospace
Copy link
Contributor

investigator has

  • is this test or stage?
  • what are the versions of the components used when running an integration test?

test and stage investigator both have that env variable set: https://github.com/thoth-station/thoth-application/blob/dacba2cea973c68773ec9f1dc8214e129269e1eb/investigator/base/deploymentconfig.yaml#L63

@pacospace
Copy link
Contributor

I run without issues test environment, but I see an error in the integration test.

THOTH_USER_API_HOST=test.thoth-station.ninja THOTH_MANAGEMENT_API_HOST=management.test.thoth-station.ninja pipenv run behave -i features/thamos_advise.featureFeature: Running thamos advise against deployment # features/thamos_advise.feature:1

  Scenario: Run a simple thamos advise for a flask application for raw HTTP connection     # features/thamos_advise.feature:3
    Given deployment is accessible using HTTPS                                             # features/steps/basic.py:31 1.534s
    When thamos advise is run for flask_py36 for recommendation type LATEST asynchronously # features/steps/basic.py:58 2.044s
    Then wait for adviser to finish successfully                                           # features/steps/basic.py:88 0.770s
      Traceback (most recent call last):
        File "/home/fmurdaca/.local/share/virtualenvs/integration-tests-ULlXhRXl/lib/python3.6/site-packages/behave/model.py", line 1329, in run
          match.run(runner.context)
        File "/home/fmurdaca/.local/share/virtualenvs/integration-tests-ULlXhRXl/lib/python3.6/site-packages/behave/matchers.py", line 98, in run
          self.func(context, *args, **kwargs)
        File "features/steps/basic.py", line 101, in wait_for_adviser_to_finish
          exit_code = response.json()["status"]["exit_code"]
      KeyError: 'exit_code'
      
      Captured logging:
      WARNING:thamos.config:TLS verification turned off, its highly recommended to use a secured connection, see configuration file for configuration options
      INFO:thamos.lib:Successfully submitted advise analysis 'adviser-345f946b' to 'https://test.thoth-station.ninja/api/v1'

    Then I should be able to retrieve adviser results                                      # None
    Then adviser result has pinned down software stack with report                         # None


Failing scenarios:
  features/thamos_advise.feature:3  Run a simple thamos advise for a flask application for raw HTTP connection

0 features passed, 1 failed, 0 skipped
0 scenarios passed, 1 failed, 0 skipped
2 steps passed, 1 failed, 2 skipped, 0 undefined
Took 0m4.348s

@pacospace
Copy link
Contributor

I ll close the issue and open in integration-tests. Feel free to open again if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants