]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
selftest: Export DC conf path for special cases
authorTim Beale <timbeale@catalyst.net.nz>
Mon, 11 Feb 2019 04:15:22 +0000 (17:15 +1300)
committerKarolin Seeger <kseeger@samba.org>
Wed, 4 Mar 2020 11:26:37 +0000 (11:26 +0000)
In a few rare cases, a test needs to assert aspects both client-side and
server-side aspects. A typical example would be the audit logging, which
is exercising client-side behaviour, but also asserting the server-side
logging.

Usually this has involved a kludge in tests.py to either use
socket-wrapper explicitly, or hardcode in the server smb.conf path.

This patch exposes the existing SERVERCONFFILE env variable to the
tests. DC_SERVERCONFFILE has been added for 2 DC testenvs, where we need
the PDC's smb.conf.

The benefit of doing this way is the filepath/testenv-dependency logic
is all self-contained with the Perl code, and it doesn't bleed out into
tests.py as well.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit aeadf75c24a4af4143e389e2b27d3a90899fb638)

Fixes autobuild with the patches for
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14285

Autobuild-User(v4-10-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-10-test): Wed Mar  4 11:26:37 UTC 2020 on sn-devel-144

selftest/selftest.pl
selftest/target/Samba4.pm

index 45eb51fa3c16d81480556fb9db333ff64110e4d4..f2968139cfd7e4c284a3f36afcdbbcf435ceefdb 100755 (executable)
@@ -888,6 +888,13 @@ my @exported_envvars = (
        "NETBIOSALIAS",
        "SAMSID",
 
+       # only use these 2 as a last resort. Some tests need to test both client-
+       # side and server-side. In this case, run as default client, ans access
+       # server's smb.conf as needed, typically using:
+       #  param.LoadParm(filename_for_non_global_lp=os.environ['SERVERCONFFILE'])
+       "SERVERCONFFILE",
+       "DC_SERVERCONFFILE",
+
        # user stuff
        "USERNAME",
        "USERID",
index c29e1c81ff88290c21443d473f3c44f91419e341..a7a6c4c95877bedaab212310beb199b1e689d071 100755 (executable)
@@ -1304,6 +1304,7 @@ rpc_server:tcpip = no
        $ret->{DC_SERVER} = $dcvars->{DC_SERVER};
        $ret->{DC_SERVER_IP} = $dcvars->{DC_SERVER_IP};
        $ret->{DC_SERVER_IPV6} = $dcvars->{DC_SERVER_IPV6};
+       $ret->{DC_SERVERCONFFILE} = $dcvars->{SERVERCONFFILE};
        $ret->{DC_NETBIOSNAME} = $dcvars->{DC_NETBIOSNAME};
        $ret->{DC_USERNAME} = $dcvars->{DC_USERNAME};
        $ret->{DC_PASSWORD} = $dcvars->{DC_PASSWORD};
@@ -1416,6 +1417,7 @@ sub provision_rpc_proxy($$$)
        $ret->{DC_SERVER} = $dcvars->{DC_SERVER};
        $ret->{DC_SERVER_IP} = $dcvars->{DC_SERVER_IP};
        $ret->{DC_SERVER_IPV6} = $dcvars->{DC_SERVER_IPV6};
+       $ret->{DC_SERVERCONFFILE} = $dcvars->{SERVERCONFFILE};
        $ret->{DC_NETBIOSNAME} = $dcvars->{DC_NETBIOSNAME};
        $ret->{DC_USERNAME} = $dcvars->{DC_USERNAME};
        $ret->{DC_PASSWORD} = $dcvars->{DC_PASSWORD};
@@ -1510,6 +1512,7 @@ sub provision_promoted_dc($$$)
        $ret->{DC_SERVER} = $dcvars->{DC_SERVER};
        $ret->{DC_SERVER_IP} = $dcvars->{DC_SERVER_IP};
        $ret->{DC_SERVER_IPV6} = $dcvars->{DC_SERVER_IPV6};
+       $ret->{DC_SERVERCONFFILE} = $dcvars->{SERVERCONFFILE};
        $ret->{DC_NETBIOSNAME} = $dcvars->{DC_NETBIOSNAME};
        $ret->{DC_USERNAME} = $dcvars->{DC_USERNAME};
        $ret->{DC_PASSWORD} = $dcvars->{DC_PASSWORD};
@@ -1601,6 +1604,7 @@ sub provision_vampire_dc($$$)
        $ret->{DC_SERVER} = $dcvars->{DC_SERVER};
        $ret->{DC_SERVER_IP} = $dcvars->{DC_SERVER_IP};
        $ret->{DC_SERVER_IPV6} = $dcvars->{DC_SERVER_IPV6};
+       $ret->{DC_SERVERCONFFILE} = $dcvars->{SERVERCONFFILE};
        $ret->{DC_NETBIOSNAME} = $dcvars->{DC_NETBIOSNAME};
        $ret->{DC_USERNAME} = $dcvars->{DC_USERNAME};
        $ret->{DC_PASSWORD} = $dcvars->{DC_PASSWORD};
@@ -1678,6 +1682,7 @@ sub provision_subdom_dc($$$)
        $ret->{DC_SERVER} = $dcvars->{DC_SERVER};
        $ret->{DC_SERVER_IP} = $dcvars->{DC_SERVER_IP};
        $ret->{DC_SERVER_IPV6} = $dcvars->{DC_SERVER_IPV6};
+       $ret->{DC_SERVERCONFFILE} = $dcvars->{SERVERCONFFILE};
        $ret->{DC_NETBIOSNAME} = $dcvars->{DC_NETBIOSNAME};
        $ret->{DC_USERNAME} = $dcvars->{DC_USERNAME};
        $ret->{DC_PASSWORD} = $dcvars->{DC_PASSWORD};
@@ -1987,6 +1992,7 @@ sub provision_rodc($$$)
        $ret->{DC_SERVER} = $dcvars->{DC_SERVER};
        $ret->{DC_SERVER_IP} = $dcvars->{DC_SERVER_IP};
        $ret->{DC_SERVER_IPV6} = $dcvars->{DC_SERVER_IPV6};
+       $ret->{DC_SERVERCONFFILE} = $dcvars->{SERVERCONFFILE};
        $ret->{DC_NETBIOSNAME} = $dcvars->{DC_NETBIOSNAME};
        $ret->{DC_USERNAME} = $dcvars->{DC_USERNAME};
        $ret->{DC_PASSWORD} = $dcvars->{DC_PASSWORD};