Welcome to the Linux Foundation Forum!

Lesson 8 labs: Can't run tests inside dinamically provisioned agent

mtuli0
mtuli0 Posts: 1
edited September 2020 in LFD254 Class Forum

Seems like the labs are out of date, I get this error when trying to run the tests for the RSVP app in the container Jenkins agents

+ virtualenv rsvpapp --system-site-packages -v
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 7, in <module>
    from virtualenv.__main__ import run_with_catch
  File "/usr/local/lib/python2.7/dist-packages/virtualenv/__init__.py", line 3, in <module>
    from .run import cli_run, session_via_cli
  File "/usr/local/lib/python2.7/dist-packages/virtualenv/run/__init__.py", line 11, in <module>
    from .plugin.activators import ActivationSelector
  File "/usr/local/lib/python2.7/dist-packages/virtualenv/run/plugin/activators.py", line 6, in <module>
    from .base import ComponentBuilder
  File "/usr/local/lib/python2.7/dist-packages/virtualenv/run/plugin/base.py", line 9, in <module>
    from importlib_metadata import entry_points
  File "/usr/local/lib/python2.7/dist-packages/importlib_metadata/__init__.py", line 9, in <module>
    import zipp
ImportError: No module named zipp
Build step 'Execute shell' marked buld as failure

Finished: FAILURE

Comments

  • chrispokorni
    chrispokorni Posts: 2,372

    Hi @mtuli0,

    Thank you for your feedback. The lab exercise and repository will be corrected as needed in a future course update release.

    Regards,
    -Chris

  • GeorgiYadkov
    GeorgiYadkov Posts: 8
    edited December 2020

    @mtuli0 I encountered the same problem. After some debugging it turns out that the pip should be upgraded and after that the virtualenv should be installed.

    Update the shell script as:

    pip install --upgrade pip #additional line
    pip install virtualenv #additional line
    virtualenv rsvpapp --system-site-packages -v
    source rsvpapp/bin/activate
    pip install -r requirements.txt
    pytest tests/test_rsvpapp.py
    >

    Alternatively this could be done in the Dockerfile at 8.1 at section:

    >
    RUN apt-get install -y python-pip
    RUN pip install --upgrade pip #additional line
    RUN pip install virtualenv
    >

    In this case the two additional lines in the shell script won't be needed.

  • Hi @mtuli0
    I encountered the same problem and after some debugging found that pip must be updated before installing virtualenv

    This can be done in two different ways:
    In the shell script:
    pip install --upgrade pip ## additional line
    pip install virtualenv ## additional line
    virtualenv rsvpapp --system-site-packages -v
    source rsvpapp/bin/activate
    pip install -r requirements.txt
    pytest tests/test_rsvpapp.py

    In the Dockerfile in the 8.1 section:
    '#Install python related package
    RUN apt-get install -y python-pip
    RUN pip install --upgrade pip ## additional line
    RUN pip install virtualenv

  • Thank you for your input @GeorgiYadkov. The additional steps will be included in a future course update release to reflect the updated installation process.

    Regards ,
    -Chris

Categories

Upcoming Training