Skip to content
Snippets Groups Projects
  1. Jan 05, 2022
    • Karel Koci's avatar
    • Karel Koci's avatar
      bca2e1a9
    • Karel Koci's avatar
      tests/contest: use SSH keys instead of password to access board · 9b4735d7
      Karel Koci authored
      This still sets the root password but that is only to unlock the
      account. The key is used instead to authenticate and access the board.
      9b4735d7
    • Karel Koci's avatar
      tests/conftest: allow a unique shell for every test · 9b6863cc
      Karel Koci authored
      This should increase tests resilience as we can now spawn new shell
      instance for every test and thus taint of shell from one test can't
      influence others.
      
      This of course needs changes in existing tests and that is not part of
      this code. The update of existing code and removal of client_board
      fixture in favor of board_access should be done in the future. For now
      client_board is documented as obsolete and not suggested for the new
      code.
      
      The disadvantage of this change is that every fixture that wants to do a
      simple call (such as uci or cat) has to create its own connection and
      that can get spammy pretty fast. The solution for this is the new
      fixture fixture_board_access. This provides one shell instance. In
      reality it provides shell instance that can reconnect. This is due to
      issues when client container would change its IP address (for example
      when we change LAN addressing).
      9b6863cc
    • Karel Koci's avatar
      nsfarm/setup/utils: add directory and file deployment setups · f173e59c
      Karel Koci authored
      These setups are handy in general. They created files and diretories
      that are automatically removed on revert.
      f173e59c
    • Karel Koci's avatar
      nsfarm/setup/board: add root password, package install setups · cd2d9f85
      Karel Koci authored
      The RootPassword is used in conftest.py and might be usable in other
      places as well. Part of this are tests on OpenWrt container to make sure
      that setup works as expected and also setups for installing packages in
      both OpenWrt and Alpine.
      cd2d9f85
    • Karel Koci's avatar
      nsfarm/setup: implement updater setup · d9fffda7
      Karel Koci authored
      This should allow us to configure and call updater in reasonably common
      way. The setup currently covers features we already were using and also
      one generic Updater centric setup that is not required at the moment but
      is going to be for future testing of updater.
      d9fffda7
    • Karel Koci's avatar
      selftests/cli: use lorem-text instead of static lorem ipsum · 973020c0
      Karel Koci authored
      This replaces static strings with generated ones from lorem-text
      library.
      
      To make tests reproducible we have to se seed for random. This is pretty
      common so this adds context function for it to toolbox.
      
      Toolbox was labeled as common tasks run on router. Now this changes it
      to just generic common toolbox and splits it to three submodules. There
      is module for Alpine Linux as well as for OpenWrt. Then there is one
      additional module for utilities needed in tests implementation.
      973020c0
    • Karel Koci's avatar
      nsfarm/board: remove obsolete abstractproperty · 56c88f7e
      Karel Koci authored
      The abstractproperty is deprecaterd since Python 3.3.
      56c88f7e
    • Karel Koci's avatar
      tests/test_bootup: move syslog_ng check · c059fad3
      Karel Koci authored
      This tests commonly fails because syslog-ng takes its time to create the
      /var/log/messages file even when it is already running. Moving it does
      not ensure that it is run later on but at least that is what happens
      right now.
      c059fad3
    • Karel Koci's avatar
      nsfarm/cli: use only one thread for FDLogging · 246c4564
      Karel Koci authored
      The FDLogging uses poll to propagate data from one feed to the other.
      This is not limited to only two file descriptors but technically any
      number of them. Thus it is way more efficient to simply add new feeds to
      existing thread over spawning the new one.
      246c4564
    • Karel Koci's avatar
      nsfarm/cli: improve and fix various issues · 13154fdf
      Karel Koci authored
      This improves cli handling in a wide variety of ways. Let's point one at
      a time.
      
      Change how we match sent command to not have issue with line break
      caused limited number of columns. Now it simply expects new line and
      return characters while it looks for characters from command. This makes
      it possible to remove hack to increase number of columns in Shell.
      
      The initial prompts in Shell were sanitized a little bit and commented.
      The "weird" prompt it turns out is caused by TERM variable and remote
      shell trying to control local terminal. One solution would be to set
      different TERM but that complicates mterm usage while debugging. The
      alternative and used option is to simply simplify regular expression to
      not have problem with it. With exception of Busybox's default prompt
      they are specific enough without having to match also new line.
      
      For the same reason as in previous paragraph the nsfarm prompt was also
      simplified. It now matches new lines only optionally. The reason is also
      that not every program terminates with new line at the end and so it is
      completely possible and valid that prompt is displayed at the end of
      line not at the beginning. The "nsfprompt" is also specific enough word
      that should not be anywhere else that we can rely only on it when we
      look for our prompt.
      
      This also fixes txt_write and bin_write as sendeof does work only on
      pexpect instance but not on fdexpect. The more correct and used option
      here is our own ctrl_d function that only signals EOF without actually
      closing stdin.
      
      The txt_read and bin_read methods gets option to not fail if file does
      not exist. The txt_write method also got option to append instead of
      overwrite.
      
      The logging was improved by implementing our own code that splits lines.
      The splitlines method is little bit too aggressive with splitting as it
      expects pretty reasonable new lines consistency usage with standards.
      The issue here is that for example '\r' that moves cursor to the left
      can be spawned multiple times and has no effect and in some cases that
      is what happens. The combination '\r\r\n' should be only one line not
      two as detected by splitlines. The code we now use detects combination
      of any number of '\r' and single '\n' as a one line split. It also
      handles only '\r' as that is commonly used to overwrite existing line so
      we consider it as new line as well. There is still a room for
      improvements such as support for backspace and other control characters.
      13154fdf
    • Karel Koci's avatar
      imgs/boot: fix prepare_turris_image script for Mox and improve · 9b1717e9
      Karel Koci authored
      This makes this script support Mox as well as it reduces unnecessary
      spam it creates in logs.
      9b1717e9
    • Karel Koci's avatar
      nsfarm/lxd/image: fix invalid syntax · 94efc8d5
      Karel Koci authored
      94efc8d5
  2. Jan 04, 2022
  3. Dec 14, 2021
  4. Dec 08, 2021
  5. Nov 23, 2021
  6. Nov 18, 2021
  7. Nov 16, 2021
    • Karel Koci's avatar
      selftests/cli: test and fix txt and bin write and read functions · eee7b93c
      Karel Koci authored
      This tests txt_write, txt_read, bin_write and bin_read Shell methods.
      
      There were also few issues with it that were discovered during the
      testing. For example calling prompt twice causes match of new prompt.
      The output of txt_read was incosistent with text prepresentation in
      Python.
      
      The new feature here is ability of txt_write to append instead of
      overwrite.
      eee7b93c
    • Karel Koci's avatar
      tests/conftest: change scope of top level fixtures to session · 03280967
      Karel Koci authored
      This was causing issue when tests from multiple packages were run in one
      session as serial console is not correctly closed on cleanup of board
      fixture.
      
      These should be session anyway as they do not cause any conflict with
      anything else (compare to boot_serial that boots and reboots the
      router). There is no reason why we would want the new instances of these
      objects, rather the opposite.
      03280967
  8. Nov 04, 2021
    • Jan Miksik's avatar
      bugfix: tests wan-pppoe · cd479b30
      Jan Miksik authored
      replaced nonexisting debug mark
      the test is now skipped due to some incompatibility
      that will be investigated.
      cd479b30
  9. Oct 13, 2021
    • Jan Betik's avatar
      tests: Added wan-pppoe tests · 32d2f461
      Jan Betik authored and Karel Koci's avatar Karel Koci committed
      Added pppoe tests and pppoe container
      Be aware that isp-pppoe container requires mounted dev/ppp
      32d2f461
    • Jan Miksik's avatar
      tests: Added DHCPv4 tests · 987b1333
      Jan Miksik authored and Karel Koci's avatar Karel Koci committed
      Added tests:
      tests/network/test_dhcp.py:
          - ip limit
          - ip range
          - ip duplicity
          - leasetime
      987b1333
    • Karel Koci's avatar
      nsfarm/lxd: improve cleanup to remove stale containers · 2341380f
      Karel Koci authored
      This improves cleanup to not only remove old images but also a stale
      containers.
      
      There are two types of containers nsfarm spawns. Those are bootstrap
      and regular containers. The bootstrap containers are spawned with
      intention to create image while regular containers are just spawned to
      be later removed. The difference is that while regular containers are
      always tied to one specific process (the instance of nsfarm) the
      bootstrap is intentionally global to serialize multiple instances on
      single image creation.
      The cleanup algorithm can remove any regular container that's parent is
      no longer running. The bootstrap containers do not contain info about
      parent process and thus we use time to remove just old containers.
      
      Warning: This changes the template for regular container name. The
      change is needed for reliable PID parsing from template name. The
      unclear state is when image would end with dash and number.
      2341380f
    • Karel Koci's avatar
      selftests/target: use ids for target · 79af6d5f
      Karel Koci authored
      This converts argument identification from 'target0' to real name of
      target.
      79af6d5f
  10. Sep 24, 2021