Please try to create the home directory for that particular user and run the command 'hdfs dfs -mkdir test'.
In your case I can see you logged in as root account, please login as hdfs account and create root account HDFS home directory and then run your command as root user.
Step 1: Login as hdfs account
Step 2: hdfs dfs -mkdir -p /user/root/
Step 3: hdfs dfs chown root /user/root/
Step 4: Login back as root account again
Step 5: Run your command 'hdfs dfs -mkdir test'
Step 6: Now you can see test directory under root account using 'hdfs dfs -ls ' or hdfs dfs -ls /user/root/'
Hope this helps you.