summaryrefslogtreecommitdiff
path: root/python/samba/tests/blackbox
AgeCommit message (Collapse)AuthorFilesLines
2019-06-07selftest: Specifically remove files generated by provisionAndrew Bartlett1-3/+11
This allows the changes in 74d15c9bf76f0a2fb5fa7b7b1d80971d10c4fe45 to be reverted, and aligns this test with others that use TestCaseInTempDir. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13978 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-06-06tests blackbox ndrdump: Clean up pep8 warningsGary Lockyer1-7/+15
Clean up the test code and remove the pep8 warnings Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Jun 6 04:58:18 UTC 2019 on sn-devel-184
2019-06-06tests blackbox ndrdump: Add test for struct printingGary Lockyer1-2/+10
Add test for the dumping of a public structure with ndrdump. This removes the need to define decode_* functions in the idl. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-29downgradedatabase: blackbox: MDB backendAaron Haslett1-3/+35
When Samba uses TDB as a backend store, all new database features are toggled on/off when GUID indexing is toggled. But, GUID indexing can't be disabled on MDB, so the other features are toggled separately. Consequently, the downgradedatabase script behaves differently depending on the database backend. This patch adds testing for the MDB behaviour. Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2019-05-29downgradedatabase: blackbox: database repackedAaron Haslett1-4/+13
Now that the database is repacked when GUID indexing is toggled on TDB, test that downgradedatabase repacks a TDB-backed database with V2 pack format database with V1. Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2019-05-29downgradedatabase: blackbox: check ordered integer removedAaron Haslett1-1/+19
Test that when we undo GUID indexing on a TDB-backed database with downgradedatabase, ORDERED_INTEGER is removed from @ATTRIBUTES Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2019-05-29downgradedatabase: blackbox testAaron Haslett1-0/+99
This test confirms that running downgradedatabase causes all GUID keys to be replaced with DN keys at the KV level Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2019-03-12test/blackbox: py3 compatible print in documentation.Douglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-01-08traffic: assert json equality in learner testDouglas Bagnall1-0/+6
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-01-08traffic tests: use TestCaseInTempdir.mktemp()Douglas Bagnall3-45/+6
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-01-08traffic_replay: --old-scale to mimic the old traffic_replayDouglas Bagnall2-0/+14
traffic_replay had a broken sense of traffic scale. That is fixed, but in order to compare old and new tests, it helps to be able to approximate the old behaviour. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-01-08traffic: add option to reanimate dying conversationsDouglas Bagnall2-0/+19
The traffic model is generated from a window in time, which makes conversations appear to start and stop unnaturally at the window boundaries. When the window is short compared to the traffic replay time and the true expected conversation length, this has a significant distorting effect, leading to more conversations than would be expected to generate a given number of packets. To offset this slightly we add the --conversation-persistence option which tries to convert apparent death into a longish wait. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-01-08traffic: generate sparser descriptions of conversationsDouglas Bagnall1-5/+0
Rather than building all the packets at this point, we stick to the barest details of the packets (which is all the model gives us anyway). The advantage is that will take a lot less memory, which matters because this process forks into many clients that were sharing and mutate the conversation list. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-01-08traffic: new version of model with packet_rate, version numberDouglas Bagnall7-48/+130
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-01-08traffic_learner: return an error codeDouglas Bagnall1-5/+2
And use it in tests, rather than expecting exact strings. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-01-08traffic_replay: drop summary replayDouglas Bagnall1-31/+3
The traffic_replay script has been able to replay a replay log as well as a model, which was not used in practice and complicated the script. If we want that feature, we can make a new script for it. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-21s4 messaging tests: Fix race condition in smbcontrol testsGary Lockyer1-1/+9
The test for the smbcontrol sleep command and the inject fault command both used the "rpc_server" process as a target. As the inject fault command caused the process to restart there was a race condition between the process restarting and the sleep test running. To prevent this the tests now use different target processes. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Dec 21 03:39:24 CET 2018 on sn-devel-144
2018-12-19s4 messaging tests: Tests for smbcontrol sleep commandGary Lockyer1-0/+39
Add a sleep command that pauses the target process for the specified number seconds This command is only enabled on developer and self test builds. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-19s4 messaging tests: Add inject fault commandGary Lockyer1-0/+85
Test for processing of the smbcontrol inject fault message in the samba daemon. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-14tests/smbcontrol: fix typo in class namePhilipp Gesang1-2/+2
Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-10python/samba/blackbox: PY3 port for samba.tests.blackbox.traffic_learnerNoel Power1-3/+22
The order of the values in the TrafficModel is different, but... also unfortunately output of json.dump is also different (even when using sorted versions of the associated dictionaries before dumping), these changes reimport the output files into TrafficModel objects rather than comparing the actual raw files. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-10python/samba.tests: Ensure samba-tool is called with correct python ver.Noel Power1-1/+1
* remove unnecessary 'bin/' part of path as base BlackBox class will do this anyway and also ensure correct detection that command needs to have 'PYTHON=blah' addeded * modify shell script so PYTHON variable if set is prepended Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-11-14python/samba/tests: PY3 Fix str/bytes issue for json.loadsNoel Power1-2/+2
Python 3.4 seems to need a string parsed = json.loads (out_jsobj) File "/usr/lib/python3.4/json/__init__.py", line 312, in loads s.__class__.__name__)) TypeError: the JSON object must be str, not 'bytes' however Python 3.5 seems to be happy to consume bytes (or string) Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-11-14python/samba/tests: PY3 port samba.tests.blackbox.netads_jsonNoel Power1-1/+2
convert output from check_output to text Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-11-14python/samba/tests: Port samba.tests.blackbox.samba_dnsupdate for PY2/PY3Noel Power1-10/+11
Make sure either the output of tests and/or the item we are searching match in type. Output of cmd in python3 is bytes, depending on the was the test is written it may be easier just to convert all output or just a single string that is used in the test Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-10-25tests/blackbox/py: remove unused importsDouglas Bagnall2-2/+0
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
2018-10-19dsdb encrypted_secrets tests: Allow "ldb://" in file pathGary Lockyer1-0/+212
When creating a new user and specifying the local file path of the sam.ldb DB, it's possible to create an account that you can't actually login with. This commit contains tests to verify the bug. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13653 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-09-22tests/blackbox: add test for net ads JSON outputPhilipp Gesang1-0/+83
Implement blackbox tests for $ net ads info --json $ net ads lookup --json that validate a) JSON wellformedness (by feeding it into the JSON library that ships with Python), and b) equality of the set of keys printed to that of the non-JSON version. Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Sat Sep 22 09:20:09 CEST 2018 on sn-devel-144
2018-09-21python tests: fix format() strings for Python 2.6Douglas Bagnall2-4/+6
Python 2.6 wants "{0}".format(x), not "{}".format(x). Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-09-05python/samba/tests: Change native string to binary for py2/py3 compatNoel Power1-2/+2
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-09-03python/samba/tests: Use io.StringIO for py3 and StringIO.StrinIO for py2Noel Power1-1/+1
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-08-24PEP8: add spaces after operatorsDouglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-08-24PEP8: fix E401: multiple imports on one lineJoe Guo1-1/+2
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E302: expected 2 blank lines, found 1Joe Guo1-0/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E226: missing whitespace around arithmetic operatorJoe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E201: whitespace after '('Joe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-07-12dns: update tool changed for scavengingAaron Haslett1-5/+13
Now that scavenging is implemented, the DNS update tool needs to be changed so that it always updates every name required by the DC. Otherwise, the records might be scavenged. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10812 Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-04-05selftest: enable py3 for samba.tests.blackbox.check_outputJoe Guo1-1/+3
convert bytes to str for Python 3 `BlackboxTestCase.check_output` will return bytes since it uses `subprocess.communicate` underneath. Convert expected string result to bytes for comparing. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-03-23samba python tests: convert print func to be py2/py3 compatibleNoel Power1-1/+2
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-03-21tests/samba_dnsupdate: Add a trivial test of automatic site coverageGarming Sam1-0/+54
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-03-05tests/smbcontrol: reduce ping test false positive rateDouglas Bagnall1-4/+36
The ping test was failing when a transient ldap_server process died between the time it was listed and the time it was pinged. We stop treating that as failure. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon Mar 5 01:33:46 CET 2018 on sn-devel-144
2018-02-24tests/blackbox/smbcontrol: ping tests names ping target upon failureDouglas Bagnall1-1/+2
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org>
2018-01-16python: fix the build with python3.Günther Deschner1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13221 Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2017-10-19python: add a failed test to show Popen deadlockJoe Guo1-0/+105
`Popen.wait()` will deadlock when using stdout=PIPE and/or stderr=PIPE and the child process generates large output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data. Use communicate() to avoid that. This patch is commited to show the issue, a fix patch will come later. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-10-19tests: Add a blackbox test for smbcontrolGary Lockyer1-0/+50
Add tests to check that samba processes have started and that they can be pinged. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-08-17tests: replace traffic_summary test with python blackbox testGary Lockyer3-0/+5084
Replace the shell subunit test for script/traffic_summary.pl with a python black box test. This involves moving the test files to more standard locations. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Thu Aug 17 07:59:38 CEST 2017 on sn-devel-144
2017-08-17scripts: Scripts to replay and generate samba trafficGary Lockyer6-0/+348
Scripts to generate representative network traffic and replay this to a samba instance. For load testing, performance profiling and capacity planning. traffic_learner process a file generated by traffic_summary and generate a model that can be used by traffic_replay to generate samba network traffic. traffic_replay Replay a summary file generated by traffic_summary, or use a model created by traffic_learner to generate network traffic. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Pair-programmed-with: Garming Sam <garming@catalyst.net.nz> Pair-programmed-with: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org> Pair-Programmed-With: Tim Beale <timbeale@catalyst.net.nz>
2017-03-28samba_dnsupdate: Add additional debuggingGarming Sam1-4/+4
Tests are still flapping, because it claims it needs a cache rebuild. Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue Mar 28 00:04:54 CEST 2017 on sn-devel-144
2017-02-14python/tests: move samba_tool_drs test to proper placeBob Campbell1-344/+0
Signed-off-by: Bob Campbell <bobcampbell@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-02-14samba-tool/drs: do partial replication when --local is given by defaultBob Campbell1-2/+2
The samba-tool drs replicate --local command would previously always do a full replication. This changes it to only replicate changes it doesn't have according to appropriate highwatermark if the appropriate repsFrom attribute exists in the local database, or an uptodateness_vector if one exists. Signed-off-by: Bob Campbell <bobcampbell@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Pair-programmed-with: Andrew Bartlett <abartlet@samba.org>