]> git.meshlink.io Git - meshlink/commitdiff
Assert that nodes black/whitelisted by name persist after closing the mesh.
authorGuus Sliepen <guus@meshlink.io>
Mon, 11 Nov 2019 21:54:46 +0000 (22:54 +0100)
committerGuus Sliepen <guus@meshlink.io>
Mon, 11 Nov 2019 21:54:46 +0000 (22:54 +0100)
test/blacklist.c

index d504460207fc38439f62cb9a1487220aaa7bcfdf..4be4cbd0d45f1fad9c283d9f5d4290f2f8f78493 100644 (file)
@@ -58,7 +58,7 @@ int main() {
                assert(asprintf(&path, "blacklist_conf.%d", i) != -1 && path);
 
                assert(meshlink_destroy(path));
-               mesh[i] = meshlink_open(path, name[i], "trio", DEV_CLASS_BACKBONE);
+               mesh[i] = meshlink_open(path, name[i], "blacklist", DEV_CLASS_BACKBONE);
                assert(mesh[i]);
                free(path);
 
@@ -177,4 +177,12 @@ int main() {
        // Check that bar has no config file for baz
        assert(access("blacklist_conf.2/current/hosts/bar", F_OK) == 0);
        assert(access("blacklist_conf.1/current/hosts/baz", F_OK) != 0 && errno == ENOENT);
+
+       // Check that we remember xyzzy but not quux after reopening the mesh
+       mesh[0] = meshlink_open("blacklist_conf.0", "foo", "blacklist", DEV_CLASS_BACKBONE);
+       assert(mesh[0]);
+       assert(meshlink_get_node(mesh[0], "xyzzy"));
+       assert(!meshlink_get_node(mesh[0], "quux"));
+
+       meshlink_close(mesh[0]);
 }