]> git.meshlink.io Git - meshlink-tiny/blobdiff - test/storage-policy.c
Remove graph, edges and communication via UDP.
[meshlink-tiny] / test / storage-policy.c
index a9aa5f49b5eeda958fb1de6315c7dc6034de7340..6885406a4a5638296e719e92f4cf7ae29516000f 100644 (file)
@@ -7,7 +7,7 @@
 #include <sys/time.h>
 #include <assert.h>
 
-#include "meshlink.h"
+#include "meshlink-tiny.h"
 #include "utils.h"
 
 int main(void) {
@@ -25,8 +25,6 @@ int main(void) {
        mesh2 = meshlink_open("storage-policy_conf.2", "bar", "storage-policy", DEV_CLASS_BACKBONE);
        assert(mesh1);
        assert(mesh2);
-       meshlink_enable_discovery(mesh1, false);
-       meshlink_enable_discovery(mesh2, false);
        meshlink_set_storage_policy(mesh1, MESHLINK_STORAGE_DISABLED);
        meshlink_set_storage_policy(mesh2, MESHLINK_STORAGE_DISABLED);
 
@@ -56,8 +54,6 @@ int main(void) {
        mesh2 = meshlink_open("storage-policy_conf.2", "bar", "storage-policy", DEV_CLASS_BACKBONE);
        assert(mesh1);
        assert(mesh2);
-       meshlink_enable_discovery(mesh1, false);
-       meshlink_enable_discovery(mesh2, false);
        meshlink_set_storage_policy(mesh1, MESHLINK_STORAGE_KEYS_ONLY);
        meshlink_set_storage_policy(mesh2, MESHLINK_STORAGE_KEYS_ONLY);
 
@@ -82,8 +78,6 @@ int main(void) {
        mesh2 = meshlink_open("storage-policy_conf.2", "bar", "storage-policy", DEV_CLASS_BACKBONE);
        assert(mesh1);
        assert(mesh2);
-       meshlink_enable_discovery(mesh1, false);
-       meshlink_enable_discovery(mesh2, false);
        meshlink_set_storage_policy(mesh1, MESHLINK_STORAGE_KEYS_ONLY);
        meshlink_set_storage_policy(mesh2, MESHLINK_STORAGE_KEYS_ONLY);
 
@@ -115,8 +109,6 @@ int main(void) {
        mesh2 = meshlink_open("storage-policy_conf.2", "bar", "storage-policy", DEV_CLASS_BACKBONE);
        assert(mesh1);
        assert(mesh2);
-       meshlink_enable_discovery(mesh1, false);
-       meshlink_enable_discovery(mesh2, false);
        meshlink_set_storage_policy(mesh1, MESHLINK_STORAGE_KEYS_ONLY);
        meshlink_set_storage_policy(mesh2, MESHLINK_STORAGE_KEYS_ONLY);
 
@@ -141,51 +133,11 @@ int main(void) {
        mesh2 = meshlink_open("storage-policy_conf.2", "bar", "storage-policy", DEV_CLASS_BACKBONE);
        assert(mesh1);
        assert(mesh2);
-       meshlink_enable_discovery(mesh1, false);
-       meshlink_enable_discovery(mesh2, false);
 
        assert(!meshlink_get_node_reachability(mesh1, meshlink_get_node(mesh1, "bar"), &last_reachable, &last_unreachable));
        assert(last_reachable);
        assert(last_unreachable);
 
-       // Start again from scratch, now use invite/join instead of import/export
-
-       close_meshlink_pair(mesh1, mesh2);
-
-       assert(meshlink_destroy("storage-policy_conf.1"));
-       assert(meshlink_destroy("storage-policy_conf.2"));
-
-       mesh1 = meshlink_open("storage-policy_conf.1", "foo", "storage-policy", DEV_CLASS_BACKBONE);
-       mesh2 = meshlink_open("storage-policy_conf.2", "bar", "storage-policy", DEV_CLASS_BACKBONE);
-       assert(mesh1);
-       assert(mesh2);
-       meshlink_enable_discovery(mesh1, false);
-       meshlink_enable_discovery(mesh2, false);
-       meshlink_set_storage_policy(mesh1, MESHLINK_STORAGE_DISABLED);
-       meshlink_set_storage_policy(mesh2, MESHLINK_STORAGE_DISABLED);
-
-       // Check that joining is not possible with storage disabled
-
-       assert(meshlink_set_canonical_address(mesh1, meshlink_get_self(mesh1), "localhost", NULL));
-       char *invitation = meshlink_invite(mesh1, NULL, "bar");
-       assert(invitation);
-       assert(meshlink_start(mesh1));
-       assert(!meshlink_join(mesh2, invitation));
-       assert(meshlink_errno == MESHLINK_EINVAL);
-       meshlink_stop(mesh1);
-
-       // Try again with KEYS_ONLY
-
-       meshlink_set_storage_policy(mesh1, MESHLINK_STORAGE_KEYS_ONLY);
-       meshlink_set_storage_policy(mesh2, MESHLINK_STORAGE_KEYS_ONLY);
-
-       assert(meshlink_start(mesh1));
-       assert(meshlink_join(mesh2, invitation));
-       assert(meshlink_errno == MESHLINK_EINVAL);
-       meshlink_stop(mesh1);
-
-       start_meshlink_pair(mesh1, mesh2);
-
        // Close the instances and reopen them.
 
        close_meshlink_pair(mesh1, mesh2);
@@ -194,8 +146,6 @@ int main(void) {
        mesh2 = meshlink_open("storage-policy_conf.2", "bar", "storage-policy", DEV_CLASS_BACKBONE);
        assert(mesh1);
        assert(mesh2);
-       meshlink_enable_discovery(mesh1, false);
-       meshlink_enable_discovery(mesh2, false);
        meshlink_set_storage_policy(mesh1, MESHLINK_STORAGE_KEYS_ONLY);
        meshlink_set_storage_policy(mesh2, MESHLINK_STORAGE_KEYS_ONLY);
 
@@ -207,5 +157,4 @@ int main(void) {
        // Done.
 
        close_meshlink_pair(mesh1, mesh2);
-       free(invitation);
 }