src/server/plugins/postgresql/pgtest.c

branch
webdav
changeset 295
73a1243fce15
parent 294
277a5896a2ec
child 296
78e92337fa4e
--- a/src/server/plugins/postgresql/pgtest.c	Mon Apr 18 10:53:13 2022 +0200
+++ b/src/server/plugins/postgresql/pgtest.c	Mon Apr 18 11:49:37 2022 +0200
@@ -211,7 +211,28 @@
 }
 
 UCX_TEST(test_pg_vfs_mkdir) {
+    Session *sn = testutil_session();
+    Request *rq = testutil_request(sn->pool, "PUT", "/");
+    rq->vfs = create_test_pgvfs(sn, rq);
+    VFSContext *vfs = vfs_request_context(sn, rq);
     
+    UCX_TEST_BEGIN;
+    
+    SYS_FILE f1 = vfs_open(vfs, "/test_mkdir/file", O_WRONLY|O_CREAT);
+    UCX_TEST_ASSERT(f1 == NULL, "open should fail");
+    
+    int r = vfs_mkdir(vfs, "/test_mkdir");
+    UCX_TEST_ASSERT(r == 0, "mkdir failed");
+    
+    f1 = vfs_open(vfs, "/test_mkdir/file", O_WRONLY|O_CREAT);
+    UCX_TEST_ASSERT(f1, "open failed");
+    
+    r = vfs_mkdir(vfs, "/test_mkdir/test_sub");
+    UCX_TEST_ASSERT(r == 0, "mkdir failed (2)");
+    
+    UCX_TEST_END;
+    
+    testutil_destroy_session(sn);
 }
 
 UCX_TEST(test_pg_vfs_unlink) {

mercurial