SIPp / pysipp

SIPp for Humans - launch multiple agents with Python
GNU General Public License v2.0
176 stars 54 forks source link

add github actions support #83

Closed linuxmaniac closed 1 year ago

linuxmaniac commented 1 year ago

As mentioned at #62 project needs to migrate CI to github actions

linuxmaniac commented 1 year ago

@goodboy I would love to see the project improve the actual situation. So, lets start with implementing the CI

goodboy commented 1 year ago

@linuxmaniac thanks for the the PR!

Do you have an example of this CI run working fully on your fork by chance?

linuxmaniac commented 1 year ago

Do you have an example of this CI run working fully on your fork by chance?

I do, but for sure it's not passing

https://github.com/linuxmaniac/pysipp/actions/runs/3565669501/jobs/5991124740

============================= test session starts ==============================
  platform linux -- Python 3.8.14, pytest-7.2.0, pluggy-1.0.0
  cachedir: .tox/py38/.pytest_cache
  rootdir: /home/runner/work/pysipp/pysipp
  collected 59 items

  tests/test_agent.py ...............                                      [ 25%]
  tests/test_commands.py .....                                             [ 33%]
  tests/test_launcher.py ..                                                [ 37%]
  tests/test_loader.py ..                                                  [ 40%]
  tests/test_stack.py .F.................................                  [[100](https://github.com/linuxmaniac/pysipp/actions/runs/3565669501/jobs/5991124740#step:5:104)%]

  =================================== FAILURES ===================================
  ______________________________ test_confpy_hooks _______________________________

  scendir = '/home/runner/work/pysipp/pysipp/tests/scens/'

      def test_confpy_hooks(scendir):
          """Test that hooks included in a confpy file work

          Assertions here are based on predefined hooks
          """
          path, scen = list(pysipp.walk(scendir + "/default_with_confpy"))[0]
          assert scen.mod
          # ordering hook should reversed agents
          agents = list(scen.agents.values())
  >       assert agents[0].is_client()
  E       assert False
  E        +  where False = <bound method UserAgent.is_client of <pysipp.agent.UserAgent object at 0x7f0fa2228580>>()
  E        +    where <bound method UserAgent.is_client of <pysipp.agent.UserAgent object at 0x7f0fa2228580>> = <pysipp.agent.UserAgent object at 0x7f0fa2228580>.is_client

  tests/test_stack.py:47: AssertionError
  =============================== warnings summary ===============================
linuxmaniac commented 1 year ago

Here is a CI for previous py27 but fails on the pypy2 environment

https://github.com/linuxmaniac/pysipp/actions/runs/3594127596

============================= test session starts ==============================
  platform linux2 -- Python 2.7.18[pypy-7.3.9-final], pytest-4.6.11, py-1.11.0, pluggy-0.13.1
  cachedir: .tox/pypy2/.pytest_cache
  rootdir: /home/runner/work/pysipp/pysipp
  collected 59 items

  tests/test_agent.py ...............                                      [ 25%]
  tests/test_commands.py .....                                             [ 33%]
  tests/test_launcher.py ..                                                [ 37%]
  tests/test_loader.py ..                                                  [ 40%]
  tests/test_stack.py F..F...............................                  [100%]

  =================================== FAILURES ===================================
  _________________________________ test_collect _________________________________

  scenwalk = <_functools.partial object at 0x00000000021b7b40>

      def test_collect(scenwalk):
          """Verify the scendir filtering hook"""
  >       assert len(list(scenwalk())) == 2

  tests/test_stack.py:17: 
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  .tox/pypy2/site-packages/pysipp/__init__.py:44: in walk
      with plugin.register([netplug] if autolocalsocks else []):
  /opt/hostedtoolcache/PyPy/2.7.18/x64/lib-python/2.7/contextlib.py:17: in __enter__
      return self.gen.next()
  .tox/pypy2/site-packages/pysipp/plugin.py:19: in register
      mng.register(p)
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

  self = <pluggy.manager.PluginManager object at 0x00000000014754b0>
  plugin = <module 'pysipp.netplug' from '/home/runner/work/pysipp/pysipp/.tox/pypy2/site-packages/pysipp/netplug.pyc'>
  name = None

      def register(self, plugin, name=None):
          """ Register a plugin and return its canonical name or ``None`` if the name
          is blocked from registering.  Raise a :py:class:`ValueError` if the plugin
          is already registered. """
          plugin_name = name or self.get_canonical_name(plugin)

          if plugin_name in self._name2plugin or plugin in self._plugin2hookcallers:
              if self._name2plugin.get(plugin_name, -1) is None:
                  return  # blocked plugin, return None to indicate no registration
              raise ValueError(
                  "Plugin already registered: %s=%s\n%s"
  >               % (plugin_name, plugin, self._name2plugin)
              )
  E           ValueError: Plugin already registered: pysipp.netplug=<module 'pysipp.netplug' from '/home/runner/work/pysipp/pysipp/.tox/pypy2/site-packages/pysipp/netplug.pyc'>
  E           {'pysipp': <module 'pysipp' from '/home/runner/work/pysipp/pysipp/.tox/pypy2/site-packages/pysipp/__init__.pyc'>, 'pysipp.netplug': <module 'pysipp.netplug' from '/home/runner/work/pysipp/pysipp/.tox/pypy2/site-packages/pysipp/netplug.pyc'>}

  .tox/pypy2/site-packages/pluggy/manager.py:[106](https://github.com/linuxmaniac/pysipp/actions/runs/3594127596/jobs/6051989633#step:5:110): ValueError
  ________________________________ test_sync_run _________________________________

  scenwalk = <_functools.partial object at 0x000000000226c090>

      def test_sync_run(scenwalk):
          """Ensure all scenarios in the test run to completion in synchronous mode"""
  >       for path, scen in scenwalk():

  tests/test_stack.py:75: 
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  .tox/pypy2/site-packages/pysipp/__init__.py:44: in walk
      with plugin.register([netplug] if autolocalsocks else []):
  /opt/hostedtoolcache/PyPy/2.7.18/x64/lib-python/2.7/contextlib.py:17: in __enter__
      return self.gen.next()
  .tox/pypy2/site-packages/pysipp/plugin.py:19: in register
      mng.register(p)
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

  self = <pluggy.manager.PluginManager object at 0x00000000014754b0>
  plugin = <module 'pysipp.netplug' from '/home/runner/work/pysipp/pysipp/.tox/pypy2/site-packages/pysipp/netplug.pyc'>
  name = None

      def register(self, plugin, name=None):
          """ Register a plugin and return its canonical name or ``None`` if the name
          is blocked from registering.  Raise a :py:class:`ValueError` if the plugin
          is already registered. """
          plugin_name = name or self.get_canonical_name(plugin)

          if plugin_name in self._name2plugin or plugin in self._plugin2hookcallers:
              if self._name2plugin.get(plugin_name, -1) is None:
                  return  # blocked plugin, return None to indicate no registration
              raise ValueError(
                  "Plugin already registered: %s=%s\n%s"
  >               % (plugin_name, plugin, self._name2plugin)
              )
  E           ValueError: Plugin already registered: pysipp.netplug=<module 'pysipp.netplug' from '/home/runner/work/pysipp/pysipp/.tox/pypy2/site-packages/pysipp/netplug.pyc'>
  E           {'pysipp': <module 'pysipp' from '/home/runner/work/pysipp/pysipp/.tox/pypy2/site-packages/pysipp/__init__.pyc'>, 'pysipp.netplug': <module 'pysipp.netplug' from '/home/runner/work/pysipp/pysipp/.tox/pypy2/site-packages/pysipp/netplug.pyc'>}

  .tox/pypy2/site-packages/pluggy/manager.py:106: ValueError
  =============================== warnings summary ===============================
goodboy commented 1 year ago

Ok so maybe to just get this all going can we skip the test_confpy_hooks test which seems to be the common failure and then possibly also unrap the suite from using tox.

If you're uncomfortable try that lmk 😸

linuxmaniac commented 1 year ago

@goodboy with this last version, all OK

https://github.com/linuxmaniac/pysipp/actions/runs/3599894859

goodboy commented 1 year ago

@linuxmaniac nice work, maybe make a followup issue for those tests as well so we don't forget about them 😂