BROKEN: TODO testprogs/blackbox/schemaupgrade.sh prove schemaInfo needs to differ
authorStefan Metzmacher <metze@samba.org>
Fri, 22 Feb 2019 23:16:22 +0000 (00:16 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 17 Feb 2020 11:44:23 +0000 (12:44 +0100)
testprogs/blackbox/schemaupgrade.sh

index 9c268277f93b952809bea5b4709c28104dec7441..f7d5cccae99eede1fa8f044fead8609d91c4b26c 100755 (executable)
@@ -18,8 +18,12 @@ cleanup_output_directories()
         rm -fr $PREFIX_ABS/2012R2_schema
     fi
 
-    if [ -d $PREFIX_ABS/2008R2_schema ]; then
-        rm -fr $PREFIX_ABS/2008R2_schema
+    if [ -d $PREFIX_ABS/2008R2_new_schema ]; then
+        rm -fr $PREFIX_ABS/2008R2_new_schema
+    fi
+
+    if [ -d $PREFIX_ABS/2008R2_old_schema ]; then
+        rm -fr $PREFIX_ABS/2008R2_old_schema
     fi
 }
 
@@ -29,8 +33,8 @@ provision_2012r2() {
     $PYTHON $BINDIR/samba-tool domain provision $PROVISION_OPTS --domain=SAMBA --realm=w2012r2.samba.corp --targetdir=$PREFIX_ABS/2012R2_schema --base-schema=2012_R2
 }
 
-provision_2008r2() {
-    $PYTHON $BINDIR/samba-tool domain provision $PROVISION_OPTS --domain=SAMBA --realm=w2008r2.samba.corp --targetdir=$PREFIX_ABS/2008R2_schema --base-schema=2008_R2
+provision_2008r2_new() {
+    $PYTHON $BINDIR/samba-tool domain provision $PROVISION_OPTS --domain=SAMBA --realm=w2008r2.samba.corp --targetdir=$PREFIX_ABS/2008R2_new_schema --base-schema=2008_R2
 }
 
 provision_2008r2_old() {
@@ -50,15 +54,21 @@ ldapcmp_ignore() {
     # objects, but we don't have the 2012 DisplaySpecifiers documentation...
     IGNORE_ATTRS="$IGNORE_ATTRS,adminContextMenu,adminPropertyPages"
 
+<<<<<<< HEAD
     echo $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/$2_schema/private/sam.ldb tdb://$PREFIX_ABS/$3_schema/private/sam.ldb --two --filter=$IGNORE_ATTRS --skip-missing-dn
+=======
+    echo "$PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/$2_schema/private/sam.ldb tdb://$PREFIX_ABS/$3_schema/private/sam.ldb --two --filter=$IGNORE_ATTRS --skip-missing-dn"
+>>>>>>> 9f91c948d6a8... TODO testprogs/blackbox/schemaupgrade.sh prove schemaInfo needs to differ
     $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/$2_schema/private/sam.ldb tdb://$PREFIX_ABS/$3_schema/private/sam.ldb --two --filter=$IGNORE_ATTRS --skip-missing-dn
 }
 
-ldapcmp_old() {
+ldapcmp_old_ignore() {
+    IGNORE_ATTRS=$1
+
     # the original 2008 schema we received from Microsoft was missing
     # descriptions and display names. This has been fixed up in the current
     # Microsoft schemas
-    IGNORE_ATTRS="adminDescription,description,adminDisplayName,displayName"
+    IGNORE_ATTRS="$IGNORE_ATTRS,adminDescription,description,adminDisplayName,displayName"
 
     # we didn't get showInAdvancedViewOnly right on Samba
     IGNORE_ATTRS="$IGNORE_ATTRS,showInAdvancedViewOnly"
@@ -66,10 +76,32 @@ ldapcmp_old() {
     ldapcmp_ignore "$IGNORE_ATTRS" "2008R2_old" "2012R2"
 }
 
-ldapcmp() {
+ldapcmp_old_check_schemaInfo() {
+    ldapcmp_old_ignore ""
+}
+
+ldapcmp_old_ignore_schemaInfo() {
+    ldapcmp_old_ignore "schemaInfo"
+}
+
+ldapcmp_new_ignore() {
+    IGNORE_ATTRS=$1
+
     # The adminDescription and adminDisplayName have been editorially
     # corrected in the 2012R2 schema but not in the adprep files.
-    ldapcmp_ignore "adminDescription,adminDisplayName"  "2008R2"  "2012R2"
+    IGNORE_ATTRS="$IGNORE_ATTRS,adminDescription,adminDisplayName"
+
+    IGNORE_ATTRS="$IGNORE_ATTRS,showInAdvancedViewOnly"
+
+    ldapcmp_ignore "$IGNORE_ATTRS"  "2008R2_new"  "2012R2"
+}
+
+ldapcmp_new_check_schemaInfo() {
+    ldapcmp_new_ignore ""
+}
+
+ldapcmp_new_ignore_schemaInfo() {
+    ldapcmp_new_ignore "schemaInfo"
 }
 
 ldapcmp_2008R2_2008R2_old() {
@@ -81,11 +113,11 @@ ldapcmp_2008R2_2008R2_old() {
     # we didn't get showInAdvancedViewOnly right on Samba
     IGNORE_ATTRS="$IGNORE_ATTRS,showInAdvancedViewOnly"
 
-    ldapcmp_ignore $IGNORE_ATTRS  "2008R2"  "2008R2_old"
+    ldapcmp_ignore $IGNORE_ATTRS  "2008R2_new"  "2008R2_old"
 }
 
-schema_upgrade() {
-       $PYTHON $BINDIR/samba-tool domain schemaupgrade -H tdb://$PREFIX_ABS/2008R2_schema/private/sam.ldb --schema=2012_R2
+schema_upgrade_new() {
+       $PYTHON $BINDIR/samba-tool domain schemaupgrade -H tdb://$PREFIX_ABS/2008R2_new_schema/private/sam.ldb --schema=2012_R2
 }
 
 schema_upgrade_old() {
@@ -95,33 +127,49 @@ schema_upgrade_old() {
 # double-check we cleaned up from the last test run
 cleanup_output_directories
 
+testit "mkdir -p PREFIX_ABS" mkdir -p "$PREFIX_ABS" || failed=`expr $failed + 1`
+
 # Provision 2 DCs, one based on the 2008R2 schema and one using 2012R2
-testit "provision_2008R2_schema" provision_2008r2
-testit "provision_2008R2_old_schema" provision_2008r2_old
-testit "provision_2012R2_schema" provision_2012r2
+testit "provision_2008R2new_schema" provision_2008r2_new || failed=`expr $failed + 1`
+testit "provision_2008R2old_schema" provision_2008r2_old || failed=`expr $failed + 1`
+testit "provision_2012R2_schema" provision_2012r2 || failed=`expr $failed + 1`
 
 # we expect the 2 schemas to be different
-testit_expect_failure "expect_schema_differences" ldapcmp
+testit_expect_failure "check_2008R2new_2012R2_schemas_differ" ldapcmp_new_ignore_schemaInfo || failed=`expr $failed + 1`
+
+# we expect the 2 schemas to be different
+testit_expect_failure "check_2008R2old_2012R2_schemas_differ" ldapcmp_old_ignore_schemaInfo || failed=`expr $failed + 1`
 
 # check that the 2 schemas are now the same, ignoring Samba bugs
-testit "check_2008R2_2008R2_schemas_same" ldapcmp_2008R2_2008R2_old
+#testit "check_2008R2old_2008R2new_schemas_same" ldapcmp_2008R2_2008R2_old || failed=`expr $failed + 1`
 
+<<<<<<< HEAD
 #testit "remember schemaInfo before upgrade" ...
 
 # upgrade the 2008 schema to 2012
 testit "schema_upgrade" schema_upgrade
+=======
+# upgrade the 2008R2new schema to 2012R2
+testit "schema_upgrade_2008R2new" schema_upgrade_new || failed=`expr $failed + 1`
+>>>>>>> 9f91c948d6a8... TODO testprogs/blackbox/schemaupgrade.sh prove schemaInfo needs to differ
 
 #testit "check schemaInfo after upgrade" ...
 
 # check that the 2 schemas are now the same
-testit "check_schemas_same" ldapcmp
+testit "check_2008R2new_upgrade_same" ldapcmp_new_ignore_schemaInfo || failed=`expr $failed + 1`
 
-# upgrade the 2008 schema to 2012
-testit "schema_upgrade_old" schema_upgrade_old
+# But schemaInfo is different
+testit_expect_failure "check_2008R2new_schemaInfo" ldapcmp_new_check_schemaInfo || failed=`expr $failed + 1`
 
-# check that the 2 schemas are now the same, ignoring Samba bugs
-testit "check_schemas_same_old" ldapcmp_old
+# upgrade the 2008R2old schema to 2012R2
+testit "schema_upgrade_2008R2old" schema_upgrade_old || failed=`expr $failed + 1`
+
+# check that the 2 schemas are now the same
+testit "check_2008R2old_upgrade_same" ldapcmp_old_ignore_schemaInfo || failed=`expr $failed + 1`
+
+# But schemaInfo is different
+testit_expect_failure "check_2008R2old_schemaInfo" ldapcmp_old_check_schemaInfo || failed=`expr $failed + 1`
 
 #cleanup_output_directories
 
-exit $failed
+testok $failed