r11897: add 2 more sgroup vs. sgroup tests with the replica having no addresses
authorStefan Metzmacher <metze@samba.org>
Fri, 25 Nov 2005 10:11:01 +0000 (10:11 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:46:43 +0000 (13:46 -0500)
metze
(This used to be commit 22b8d5014af181aa755ecc5389d9e4bd32d02cab)

source4/torture/nbt/winsreplication.c

index 8667b9d351dbe7c7f87cc1e7b88dcd1e7237c815..1fd68cadb8852834ec46ffb2baf0b49f8a43186a 100644 (file)
@@ -394,6 +394,24 @@ static const struct wrepl_ip addresses_A_3_4_X_3_4[] = {
        .ip     = TEST_ADDRESS_X_PREFIX".4"
        }
 };
+static const struct wrepl_ip addresses_A_3_4_B_3_4[] = {
+       {
+       .owner  = TEST_OWNER_A_ADDRESS,
+       .ip     = TEST_ADDRESS_A_PREFIX".3"
+       },
+       {
+       .owner  = TEST_OWNER_A_ADDRESS,
+       .ip     = TEST_ADDRESS_A_PREFIX".4"
+       },
+       {
+       .owner  = TEST_OWNER_B_ADDRESS,
+       .ip     = TEST_ADDRESS_B_PREFIX".3"
+       },
+       {
+       .owner  = TEST_OWNER_B_ADDRESS,
+       .ip     = TEST_ADDRESS_B_PREFIX".4"
+       }
+};
 static const struct wrepl_ip addresses_A_3_4_OWNER_B[] = {
        {
        .owner  = TEST_OWNER_B_ADDRESS,
@@ -4036,6 +4054,37 @@ static BOOL test_conflict_different_owner(struct test_wrepl_conflict_conn *ctx)
                        .sgroup_cleanup = True
                }
        },
+       /* 
+        * sgroup,active vs. sgroup,active same addresses
+        * => should be NOT replaced
+        */
+       {
+               .line   = __location__,
+               .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
+               .comment= "A:A_3_4 vs. B:NULL",
+               .extra  = True,
+               .r1     = {
+                       .owner          = &ctx->a,
+                       .type           = WREPL_TYPE_SGROUP,
+                       .state          = WREPL_STATE_ACTIVE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_A_3_4),
+                       .ips            = addresses_A_3_4,
+                       .apply_expected = True
+               },
+               .r2     = {
+                       .owner          = &ctx->b,
+                       .type           = WREPL_TYPE_SGROUP,
+                       .state          = WREPL_STATE_ACTIVE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = 0,
+                       .ips            = NULL,
+                       .apply_expected = False,
+                       .sgroup_cleanup = True
+               }
+       },
        /* 
         * sgroup,active vs. sgroup,active subset addresses, special case...
         * => should NOT be replaced
@@ -4440,6 +4489,63 @@ static BOOL test_conflict_different_owner(struct test_wrepl_conflict_conn *ctx)
                        .apply_expected = False,
                }
        },
+       /* 
+        * sgroup,active vs. sgroup,active different addresses, special case...
+        * => should be merged
+        */
+       {
+               .line   = __location__,
+               .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
+               .comment= "A:A_3_4_B_3_4 vs. B:NULL => B:A_3_4",
+               .extra  = True,
+               .r1     = {
+                       .owner          = &ctx->a,
+                       .type           = WREPL_TYPE_SGROUP,
+                       .state          = WREPL_STATE_ACTIVE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_A_3_4_B_3_4),
+                       .ips            = addresses_A_3_4_B_3_4,
+                       .apply_expected = True,
+               },
+               .r2     = {
+                       .owner          = &ctx->b,
+                       .type           = WREPL_TYPE_SGROUP,
+                       .state          = WREPL_STATE_ACTIVE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = 0,
+                       .ips            = NULL,
+                       .sgroup_merge   = True,
+                       .merge_owner    = &ctx->b,
+                       .sgroup_cleanup = True
+               }
+       },
+       {
+               .line   = __location__,
+               .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
+               .cleanup= True,
+               .r1     = {
+                       .owner          = &ctx->a,
+                       .type           = WREPL_TYPE_SGROUP,
+                       .state          = WREPL_STATE_ACTIVE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = 0,
+                       .ips            = NULL,
+                       .apply_expected = False,
+               },
+               .r2     = {
+                       .owner          = &ctx->a,
+                       .type           = WREPL_TYPE_UNIQUE,
+                       .state          = WREPL_STATE_TOMBSTONE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_A_1),
+                       .ips            = addresses_A_1,
+                       .apply_expected = True,
+               }
+       },
        /* 
         * sgroup,active vs. sgroup,active different addresses, special case...
         * => should be merged
@@ -4536,7 +4642,7 @@ static BOOL test_conflict_different_owner(struct test_wrepl_conflict_conn *ctx)
        printf("Test Replica Conflicts with different owners\n");
 
        for(i=0; ret && i < ARRAY_SIZE(records); i++) {
-       
+
                if (!records[i].extra && !records[i].cleanup) {
                        /* we should test the worst cases */
                        if (records[i].r2.apply_expected && records[i].r1.ips==records[i].r2.ips) {