Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Feature: Generic discovery and poller tests #7873
DO NOT DELETE THIS TEXT
If you would like to test this pull request then please run:
You probably already know but needs docs + help info in the script file.
Trying to start snmpsimd using the args from the script:
-bash-4.2$ snmpsimd.py --data-dir=./tests/snmpsim --agent-udpv4-endpoint=127.1.6.1:1161 --logging-method=file:/tmp/snmpsimd.log Traceback (most recent call last): File "/usr/lib/python3.4/site-packages/snmpsim-0.3.0-py3.4.egg/snmpsim/record/search/database.py", line 106, in create oid, tag, val = self.__textParser.grammar.parse(line) File "/usr/lib/python3.4/site-packages/snmpsim-0.3.0-py3.4.egg/snmpsim/grammar/snmprec.py", line 39, in parse raise error.SnmpsimError('broken record <%s>' % line) snmpsim.error.SnmpsimError: broken record <b'18.104.22.168.22.214.171.124.126.96.36.199608||Intel Xeon E3-12xx v2 (Ivy Bridge)\n'> During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/bin/snmpsimd.py", line 4, in <module> __import__('pkg_resources').run_script('snmpsim==0.3.0', 'snmpsimd.py') File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 746, in run_script self.require(requires).run_script(script_name, ns) File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 1501, in run_script exec(code, namespace, namespace) File "/usr/lib/python3.4/site-packages/snmpsim-0.3.0-py3.4.egg/EGG-INFO/scripts/snmpsimd.py", line 1199, in <module> snmpContext File "/usr/lib/python3.4/site-packages/snmpsim-0.3.0-py3.4.egg/EGG-INFO/scripts/snmpsimd.py", line 836, in configureManagedObjects dataFile = DataFile(fullPath, textParser).indexText(forceIndexBuild) File "/usr/lib/python3.4/site-packages/snmpsim-0.3.0-py3.4.egg/EGG-INFO/scripts/snmpsimd.py", line 217, in indexText self.__recordIndex.create(forceIndexBuild, validateData) File "/usr/lib/python3.4/site-packages/snmpsim-0.3.0-py3.4.egg/snmpsim/record/search/database.py", line 114, in create raise error.SnmpsimError('Data error at %s:%d: %s' % (self.__textFile, lineNo, exc)) snmpsim.error.SnmpsimError: Data error at ./tests/snmpsim/linux.snmprec:29: broken record <b'188.8.131.52.184.108.40.206.220.127.116.11608||Intel Xeon E3-12xx v2 (Ivy Bridge)\n'> -bash-4.2$ snmpsimd.py --data-dir=./tests/snmpsim --agent-udpv4-endpoint=127.1.6.1:1161 --logging-method=file:/tmp/snmpsimd.log^C -bash-4.2$ grep '18.104.22.168.22.214.171.124.126.96.36.199608' ./tests/snmpsim/* ./tests/snmpsim/linux.snmprec:188.8.131.52.184.108.40.206.220.127.116.11608||Intel Xeon E3-12xx v2 (Ivy Bridge)
Also, are we going to be expecting users to submit this as I feel like it's going to raise the barrier to people contributing PRs.
Definitely a huge step forward and for me and you we can submit them when doing PRs for devices.
Yeah, requiring testing is a big barrier, I am worried about that too, but I hope to make it dead simple with the script. The benefits of having the tests should be pretty clear :)
I fixed a lot of issues with the save-test-data.php script today, remove the snmprec file and try again.
I'll add some docs after things settle down. save-test-data.php has help text now :D
Works better now.
For me running
Yes, but that is why we should use variants. Once all the modules are added. We won't need to update specific os captures much.
Also for devices, the data won't change as wildly as it does for servers.
When merging existing snmprec and new snmprec I could prefer existing data over new? Which do you think is better?
I've still not read the code so some of this will be answered in there I'm sure.
Still adds data to the test files, is that expected:
I do find that I need to run the script twice, the first time snmpsimd doesn't start the first time for some reason.
Still not sure if that means it's ready for a merge @murrant :)
I'm trying to fix the travis issue at the moment, think I'm going to resort to just dropping the check for poller-service.py for now.