From 372c2ea4dc701c985afde4c9f292cc6cb7b04c16 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 21 Aug 2006 10:45:58 +0000 Subject: r17661: A patch from Martin Kuehl: This commit extends the samba3sam test suite, which contains tests for the samba3sam and ldb_map modules, with a lot of tests for inbound, i.e. add, modify, rename and delete requests. The tests each add a single record, modify it, rename it, and then delete it, at each step checking that the operations were successful and that the right data went into the right partitions. They are run for an unmapped record, a mapped record with data only in the remote partition, a mapped record with remote data that is later modified to include local data, and a mapped record with data in both the local and remote partitions. It also adds a function to the backend objects that makes construction of DNs for their respective partitions more comfortable. Cheers, Martin (This used to be commit 1ddd06f24d71c606241863cf4fe047833c64a6d2) --- testprogs/ejs/samba3sam.js | 535 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 464 insertions(+), 71 deletions(-) (limited to 'testprogs') diff --git a/testprogs/ejs/samba3sam.js b/testprogs/ejs/samba3sam.js index bac381fa01..217ac6912a 100755 --- a/testprogs/ejs/samba3sam.js +++ b/testprogs/ejs/samba3sam.js @@ -227,7 +227,7 @@ function test_map_search(ldb, s3, s4) /* Add a set of split records */ var ldif = " -dn: cn=X,sambaDomainName=TESTS,${BASEDN} +dn: " + s4.dn("cn=X") + " objectClass: user cn: X codePage: x @@ -239,7 +239,7 @@ description: x objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 primaryGroupID: 1-5-21-4231626423-2410014848-2360679739-512 -dn: cn=Y,sambaDomainName=TESTS,${BASEDN} +dn: " + s4.dn("cn=Y") + " objectClass: top cn: Y codePage: x @@ -249,7 +249,7 @@ nextRid: y lastLogon: y description: x -dn: cn=Z,sambaDomainName=TESTS,${BASEDN} +dn: " + s4.dn("cn=Z") + " objectClass: top cn: Z codePage: x @@ -266,7 +266,7 @@ description: y /* Add a set of remote records */ var ldif = " -dn: cn=A,sambaDomainName=TESTS,${BASEDN} +dn: " + s3.dn("cn=A") + " objectClass: posixAccount cn: A sambaNextRid: x @@ -276,7 +276,7 @@ description: x sambaSID: S-1-5-21-4231626423-2410014848-2360679739-552 sambaPrimaryGroupSID: S-1-5-21-4231626423-2410014848-2360679739-512 -dn: cn=B,sambaDomainName=TESTS,${BASEDN} +dn: " + s3.dn("cn=B") + " objectClass: top cn:B sambaNextRid: x @@ -284,7 +284,7 @@ sambaBadPasswordCount: x sambaLogonTime: y description: x -dn: cn=C,sambaDomainName=TESTS,${BASEDN} +dn: " + s3.dn("cn=C") + " objectClass: top cn: C sambaNextRid: x @@ -300,7 +300,7 @@ description: y println("Testing search by DN"); /* Search remote record by local DN */ - dn = "cn=A,sambaDomainName=TESTS," + s4.BASEDN; + dn = s4.dn("cn=A"); attrs = new Array("objectCategory", "lastLogon"); res = ldb.search("", dn, ldb.SCOPE_BASE, attrs); assert(res != undefined); @@ -310,7 +310,7 @@ description: y assert(res[0].lastLogon == "x"); /* Search remote record by remote DN */ - dn = "cn=A,sambaDomainName=TESTS," + s3.BASEDN; + dn = s3.dn("cn=A"); attrs = new Array("objectCategory", "lastLogon", "sambaLogonTime"); res = s3.db.search("", dn, ldb.SCOPE_BASE, attrs); assert(res != undefined); @@ -321,7 +321,7 @@ description: y assert(res[0].sambaLogonTime == "x"); /* Search split record by local DN */ - dn = "cn=X,sambaDomainName=TESTS," + s4.BASEDN; + dn = s4.dn("cn=X"); attrs = new Array("objectCategory", "lastLogon"); res = ldb.search("", dn, ldb.SCOPE_BASE, attrs); assert(res != undefined); @@ -331,7 +331,7 @@ description: y assert(res[0].lastLogon == "x"); /* Search split record by remote DN */ - dn = "cn=X,sambaDomainName=TESTS," + s3.BASEDN; + dn = s3.dn("cn=X"); attrs = new Array("objectCategory", "lastLogon", "sambaLogonTime"); res = s3.db.search("", dn, ldb.SCOPE_BASE, attrs); assert(res != undefined); @@ -348,10 +348,10 @@ description: y res = ldb.search("(revision=x)", NULL, ldb. SCOPE_DEFAULT, attrs); assert(res != undefined); assert(res.length == 2); - assert(res[0].dn == ("cn=Y,sambaDomainName=TESTS," + s4.BASEDN)); + assert(res[0].dn == s4.dn("cn=Y")); assert(res[0].objectCategory == "y"); assert(res[0].lastLogon == "y"); - assert(res[1].dn == ("cn=X,sambaDomainName=TESTS," + s4.BASEDN)); + assert(res[1].dn == s4.dn("cn=X")); assert(res[1].objectCategory == "x"); assert(res[1].lastLogon == "x"); @@ -360,10 +360,10 @@ description: y res = ldb.search("(description=y)", NULL, ldb. SCOPE_DEFAULT, attrs); assert(res != undefined); assert(res.length == 2); - assert(res[0].dn == ("cn=Z,sambaDomainName=TESTS," + s4.BASEDN)); + assert(res[0].dn == s4.dn("cn=Z")); assert(res[0].objectCategory == "z"); assert(res[0].lastLogon == "z"); - assert(res[1].dn == ("cn=C,sambaDomainName=TESTS," + s4.BASEDN)); + assert(res[1].dn == s4.dn("cn=C")); assert(res[1].objectCategory == undefined); assert(res[1].lastLogon == "z"); @@ -372,10 +372,10 @@ description: y res = ldb.search("(badPwdCount=x)", NULL, ldb. SCOPE_DEFAULT, attrs); assert(res != undefined); assert(res.length == 2); - assert(res[0].dn == ("cn=B,sambaDomainName=TESTS," + s4.BASEDN)); + assert(res[0].dn == s4.dn("cn=B")); assert(res[0].objectCategory == undefined); assert(res[0].lastLogon == "y"); - assert(res[1].dn == ("cn=A,sambaDomainName=TESTS," + s4.BASEDN)); + assert(res[1].dn == s4.dn("cn=A")); assert(res[1].objectCategory == undefined); assert(res[1].lastLogon == "x"); @@ -389,11 +389,11 @@ description: y res = ldb.search("(objectSid=*)", NULL, ldb. SCOPE_DEFAULT, attrs); assert(res != undefined); assert(res.length == 2); - assert(res[0].dn == ("cn=X,sambaDomainName=TESTS," + s4.BASEDN)); + assert(res[0].dn == s4.dn("cn=X")); assert(res[0].objectCategory == "x"); assert(res[0].lastLogon == "x"); assert(res[0].objectSid == "S-1-5-21-4231626423-2410014848-2360679739-552"); - assert(res[1].dn == ("cn=A,sambaDomainName=TESTS," + s4.BASEDN)); + assert(res[1].dn == s4.dn("cn=A")); assert(res[1].objectCategory == undefined); assert(res[1].lastLogon == "x"); assert(res[1].objectSid == "S-1-5-21-4231626423-2410014848-2360679739-552"); @@ -405,7 +405,7 @@ description: y res = ldb.search("(primaryGroupID=1-5-21-4231626423-2410014848-2360679739-512)", NULL, ldb. SCOPE_DEFAULT, attrs); assert(res != undefined); assert(res.length == 1); - assert(res[0].dn == ("cn=A,sambaDomainName=TESTS," + s4.BASEDN)); + assert(res[0].dn == s4.dn("cn=A")); assert(res[0].objectCategory == undefined); assert(res[0].lastLogon == "x"); assert(res[0].primaryGroupID == "1-5-21-4231626423-2410014848-2360679739-512"); @@ -437,12 +437,12 @@ description: y res = ldb.search("(objectClass=user)", NULL, ldb. SCOPE_DEFAULT, attrs); assert(res != undefined); assert(res.length == 2); - assert(res[0].dn == ("cn=X,sambaDomainName=TESTS," + s4.BASEDN)); + assert(res[0].dn == s4.dn("cn=X")); assert(res[0].objectCategory == "x"); assert(res[0].lastLogon == "x"); assert(res[0].objectClass != undefined); assert(res[0].objectClass[3] == "user"); - assert(res[1].dn == ("cn=A,sambaDomainName=TESTS," + s4.BASEDN)); + assert(res[1].dn == s4.dn("cn=A")); assert(res[1].objectCategory == undefined); assert(res[1].lastLogon == "x"); assert(res[1].objectClass != undefined); @@ -452,19 +452,19 @@ description: y res = ldb.search("(|(objectClass=user)(badPwdCount=x))", NULL, ldb. SCOPE_DEFAULT, attrs); assert(res != undefined); assert(res.length == 3); - assert(res[0].dn == ("cn=B,sambaDomainName=TESTS," + s4.BASEDN)); + assert(res[0].dn == s4.dn("cn=B")); assert(res[0].objectCategory == undefined); assert(res[0].lastLogon == "y"); assert(res[0].objectClass != undefined); for (i=0;i