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

[Unittesting P3] lime.config tests and utils #564



Copy link

commented Aug 24, 2019

Add testing utils and tests to lime.config. As like all the unittesting patch series this changes should not change behaviour.

Should be applied after P2 (#563).
Hint: easer review doing commit by commit.

jonesmz and others added 30 commits Jul 10, 2019
Have forward it's arguments to dnsmasq-lease-s…

In my testing, I saw dnsmasq use a very large amount of CPU, and calling over and over again with the same collections of arguments.

I noticed that this script wasn't calling the lua file with any arguments.

Making this change resolves the dnsmasq process using lots of CPU.

Is there anything obvious that this change will break? I'm actually a little confused how DHCP was working properly in my mesh before making this change.
Merge pull request #548 from jonesmz/patch-1
Have forward it's arguments to dnsmasq-lease-share.lua
Merge pull request #550 from spiccinini/fix_travis
Fix travis package build
safe-upgrade: remove --preserve-full-config cmdline arg
The idea behing having a --preserve-full-config options was that
if safe-upgrade was run without -n then it will preserve a minimal
configuration and with --preeserve-full-config the whole config
as sysupgrade does. The thing is that the minimal config preservation
is not implemented so having a --preserve-full-config is confusing.
Merge pull request #553 from spiccinini/fix_sysupgrade_preserve
safe-upgrade: remove --preserve-full-config cmdline arg
Merge pull request #552 from ilario/limedefault
Remove a repetition in lime-defaults-factory
Merge pull request #546 from libremesh/fix/bat-hosts
In bat-host take iface name as unique key
Merge pull request #560 from ilario/travis-test
Updated directory name inside Travis file
Merge pull request #555 from ilario/removeLineChanIndex
Remove unused line from wireless.lua
Merge pull request #561 from ilario/update_sdk.config
Add all packages to libremesh.sdk.config
Merge pull request #559 from ilario/netperf_dependency
Add netperf dependency to ubus-lime-metrics Makefile
restructure lua modules in files/path structure
This change allows uniform and easy path handling in unit tests.
Also the removal of comments is adapted and improved.
testing: add dockerfile for unittesting
Based on a (very small!) Alpine Linux image with lua 5.1 and
luarocks installed.
As some openwrt modules are needed or extremely helpful, eg uci,
libjson-c, luci-lib-ip, nixio, they are installed directly from
the 18.06.4 x86_64 packages. The rationale is to have a minimal
maintenance but at the same time do not reinvent the wheel.
Some modules should be faked instead of installed, eg: iwinfo.
testing: add tools for downloading packages from a 'debian style' repo
This tools allow downloading packages from openwrt repositories without
needing the full URL to the package, minimizing the maintenance effort.
testing: add ./tools/dockertestshell script
This tool provides an easy way to develop or test things within the testing docker image.
Some features:
* /home/$USER is mounted inside the docker image so each change you do to the code from
inside is maintained when you close the docker container
* the same applies to /tmp
* same user outside and inside docker
* network access is garanted
* allows specifying a different image tag (allowing easy upgades)
* and some goodies like bashrc, some useful ENV variables, PS1 modification, etc.

This script is also used by the run_tests script.
testing: add ./run_tests script
This script must be used to run the tests, it builds the docker
image if it is not available, and then run the tests.
When an upgrade must me done to the Docker image it can be forced
incrementing the tag in run_tests
ci: add unit-testing to travis
CI is refactored into two stages: unittests and pkgbuild.
lime.config: add config.get_uci_cursor and set_uci_cursor
Sets and returns a uci context.
All calls to libuci:cursor() must be replaced with get_uci_cursor
in order to allow the code to be tested in unittests.
spiccinini added 5 commits Aug 22, 2019
testing: add setup_test_uci and teardown_test_uci
This methods must be used to create a clean uci environment for
each test. The uci environment is created in a temporary directory
in /tmp and empty config files are created. To delete this environment
teardown_test_uci must be called after each test.
lime.config: use config.log instead of print
So it can be turned off inside unittests.
tests/utils.lua Show resolved Hide resolved

@gmarcos87 gmarcos87 self-requested a review Sep 2, 2019

@spiccinini spiccinini changed the base branch from master to fix/bat-hosts Sep 2, 2019

@gmarcos87 gmarcos87 merged commit 894cca6 into libremesh:fix/bat-hosts Sep 2, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
6 participants
You can’t perform that action at this time.