Selftest namespaces: Difference between revisions

From SambaWiki
No edit summary
Line 26: Line 26:
=== Known issues and limitations ===
=== Known issues and limitations ===


Refer to [https://gitlab.com/samba-team/samba/blob/master/selftest/ns/README selftest/ns/README].
''<Any outstanding bugs, configurations not supported, etc>''


=== Troubleshooting ===
=== Troubleshooting ===


You can use standard packet capture tools, such as wireshark and tcpdump, to debug the Samba traffic. However, you would have to attach to the testenv namespace first, i.e. run <tt>./st/ad_dc/nsenter.sh</tt>.
''<What debug level do you need to run to see messages of interest. Are there any other ways to verify the feature is doing what it should>''


== For Developers ==
== For Developers ==

=== How to test it ===

<pre>
make test TESTS=blah
</pre>

''<Anything else notable about running the tests...>''


=== Where the code is located ===
=== Where the code is located ===


The scripts to setup namespaces are in [https://gitlab.com/samba-team/samba/blob/master/selftest/ns/ selftest/ns/]. You can find the places that namespaces hook into the selftest framework by using:
''<Notable files/functions to start looking at...>''
<pre>git grep "USE_NAMESPACES\|selftest/ns"</pre>

=== Reference Docs ===

''<E.g. Microsoft specification/section that describes the feature in more detail>''


[[Category:New Feature]]
[[Category:New Feature]]

Revision as of 04:40, 10 June 2019

Overview

Added in Samba version: v4.11

The use of namespaces in the selftest system is only really of interest to Samba developers, or users who want to utilize the customdc selftest environment.

Currently the Samba selftest framework uses cwrap socket-wrapper to 'fake' network connections between the Samba testenv DCs. Each DC has a 127.0.0.<id> IP address and socket wrapper uses the '<id>' to work out which DC to pass the packets to.

As an alternative to using cwrap, there is experimental selftest support to use the kernel Namespaces to isolate the testenvs. This uses a mix of network namespaces in the kernel, for isolation, and veth tunnel interfaces, to connect together the separate testenv namespaces. The Samba testenv DC becomes more like a containerized system.

For more details on what namespaces are and how selftest uses them, see selftest/ns/README.

How to configure it

To use namespaces instead of socket-wrapper, just add 'USE_NAMESPACES=1' to the make command, e.g.

  • To run the 'quick' test cases using namespaces:
USE_NAMESPACES=1 make test TESTS=quick
  • To setup an ad_dc testenv using namespaces:
USE_NAMESPACES=1 SELFTEST_TESTENV=ad_dc make testenv
You can then connect secondary shells to the namespace your testenv is running in. The command to do this is a little complicated, so a helper 'nsenter.sh' script gets autogenerated when the testenv is created. E.g. to connect to the testenv that the ad_dc is running in, use:
./st/ad_dc/nsenter.sh

Known issues and limitations

Refer to selftest/ns/README.

Troubleshooting

You can use standard packet capture tools, such as wireshark and tcpdump, to debug the Samba traffic. However, you would have to attach to the testenv namespace first, i.e. run ./st/ad_dc/nsenter.sh.

For Developers

Where the code is located

The scripts to setup namespaces are in selftest/ns/. You can find the places that namespaces hook into the selftest framework by using:

git grep "USE_NAMESPACES\|selftest/ns"