Skip to content

Commit

Permalink
fix some logs
Browse files Browse the repository at this point in the history
  • Loading branch information
diqiu50 committed Jan 7, 2025
1 parent 4e34bd2 commit 1f014f6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
34 changes: 29 additions & 5 deletions clients/filesystem-fuse/tests/bin/start_backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ check_gravitino_server_ready() {

check_gravitino_server_ready "$GRAVITINO_SERVER_URL/api/metalakes"

echo "Create the metalake, catalog, schema, and fileset"
# create metalake
curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
curl -s -o /dev/null -X POST -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
"name":"test","comment":"comment","properties":{}
}' $GRAVITINO_SERVER_URL/api/metalakes

# create catalog
curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
curl -s -o /dev/null -X POST -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
"name": "c1",
"type": "FILESET",
Expand All @@ -94,18 +95,17 @@ curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
}' $GRAVITINO_SERVER_URL/api/metalakes/test/catalogs

# create schema
curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
curl -s -o /dev/null -X POST -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
"name":"s1","comment":"comment","properties":{}
}' $GRAVITINO_SERVER_URL/api/metalakes/test/catalogs/c1/schemas

# create FILESET
curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
curl -s -o /dev/null -X POST -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
"name":"fileset1","comment":"comment","properties":{}
}' $GRAVITINO_SERVER_URL/api/metalakes/test/catalogs/c1/schemas/s1/filesets


echo "Start the Gvfs fuse client"

MOUNT_DIR=$CLIENT_FUSE_DIR/target/gvfs
Expand Down Expand Up @@ -152,7 +152,31 @@ $CLIENT_FUSE_DIR/target/debug/gvfs-fuse $MOUNT_DIR $MOUNT_FROM_LOCATION $CONF_FI
FUSE_PID=$!
echo "Gvfs fuse started with PID: $FUSE_PID"

#check the gvfs-fuse is ready
check_gvfs_fuse_ready() {
local retries=10
local wait_time=1

for ((i=1; i<=retries; i++)); do
# check the $MOUNT_DIR/.gvfs_meta is exist
if [ -f "$MOUNT_DIR/.gvfs_meta" ]; then
echo "Gvfs fuse is ready."
return 0
else
echo "Attempt $i/$retries: Gvfs fuse not ready. Retrying in $wait_time seconds..."
sleep "$wait_time"
fi
done

echo "Error: Gvfs fuse did not become ready after $((retries * wait_time)) seconds."
exit 1
}

check_gvfs_fuse_ready

# run the integration test
cd $CLIENT_FUSE_DIR
export RUN_TEST_WITH_BACKGROUND=1
cargo test --test fuse_test test_fuse_system_with_manual -- --exact

sleep 3
6 changes: 3 additions & 3 deletions clients/filesystem-fuse/tests/fuse_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ fn test_fuse_filesystem(mount_point: &str) {
fs::write(&test_file, "read test").expect("Failed to write file");

//test read file
let content = fs::read_to_string(test_file.clone()).expect("Failed to read file");
let content = fs::read_to_string(&test_file).expect("Failed to read file");
assert_eq!(content, "read test", "File content mismatch");

//test delete file
fs::remove_file(test_file.clone()).expect("Failed to delete file");
assert!(!file_exists(test_file));
fs::remove_file(&test_file).expect("Failed to delete file");
assert!(!file_exists(&test_file));

//test create directory
let test_dir = base_path.join("test_dir");
Expand Down

0 comments on commit 1f014f6

Please sign in to comment.