The scripts are working perfectly in workspace but it fails test cases. [Attaching log file content]

2020-02-02 15:43:50,942 unitTesting INFO Running command_runner
2020-02-02 15:43:51,057 unitTesting INFO Running setup.sh…
2020-02-02 15:43:52,422 unitTesting INFO Module setup complete!
2020-02-02 15:43:52,423 unitTesting INFO Starting assessment…
2020-02-02 15:43:52,424 unitTesting INFO Assessing list_files.sh
2020-02-02 15:43:52,898 unitTesting ERROR /prashant-kumarjha63-ME_QBOX-cb264b00-45d2-11ea-8613-83581b59d835/execution_dir/list_files.sh returncode > 0! Check your code.
2020-02-02 15:43:52,899 unitTesting INFO File: list_files.sh | Status: TEST_STATUS_FAILURE
2020-02-02 15:43:52,899 unitTesting INFO Assessing print_directory_structure.sh
2020-02-02 15:43:53,505 unitTesting INFO
User output:
mkdir: cannot create directory ‘/home/crio-user/workspace/QBox/backup’: No such file or directory
mkdir: cannot create directory ‘/home/crio-user/workspace/QBox/transfer’: No such file or directory
cp: cannot stat ‘/home/crio-user/workspace/QBox/logs/vsftpd1.log’: No such file or directory
/home/crio-user/workspace/QBox/ [error opening dir]

0 directories, 0 files

Actual output:
.
|-- backup
| -- vsftpd1.log |-- logs | |-- vsftpd1.log | |-- vsftpd2.log | – vsftpd3.log
`-- transfer

3 directories, 4 files

2020-02-02 15:43:53,506 unitTesting INFO File: print_directory_structure.sh | Status: TEST_STATUS_FAILURE
2020-02-02 15:43:53,507 unitTesting INFO Assessing print_home_directory.sh
2020-02-02 15:43:53,964 unitTesting INFO File: print_home_directory.sh | Status: TEST_STATUS_SUCCESS
2020-02-02 15:43:53,965 unitTesting INFO Assessing print_number_of_occurrences.sh
2020-02-02 15:43:54,490 unitTesting INFO
User output:
grep: /home/crio-user/workspace/QBox/logs/vsftpd1.log: No such file or directory
0

Actual output:
32

2020-02-02 15:43:54,492 unitTesting INFO File: print_number_of_occurrences.sh | Status: TEST_STATUS_FAILURE
2020-02-02 15:43:54,492 unitTesting INFO Assessment finished!
2020-02-02 15:43:54,492 unitTesting INFO Starting cleanup…
2020-02-02 15:43:54,556 unitTesting INFO Running cleanup.sh…

Yeah. I’m experiencing the same issue @Prashant

Don’t hardcode the path. Use ~/ to represent the home directory. The user’s home could be different on another machine.

4 Likes

Thank you @Kiran . Worked