Libelektra: Test cases may fail if config files already exist

Created on 18 Aug 2018  路  6Comments  路  Source: ElektraInitiative/libelektra

For example:

  • testshell_markdown_ccode and testshell_markdown_tcl fail if ~/.config/config.tcl is a non-TCL file
  • testshell_markdown_tutorial_validation fails if ~/.config/tutorial.dump contains user/tests/tutorial/spec/should_not_be_here
  • testshell_markdown_toml fails if ~/.config/test.toml exists

Furthermore, the situation, that our tests simply start modifying already existing config files, is not ideal.

Two ways to resolve this:

  • the shell recorder moves and restores config files if they were already present (but not created by earlier lines of the shell recorder test)
  • the shell recorder prefixes the names of the config files
bug testing

All 6 comments

I think the most simple solution would be to reserve a certain prefix for MSR config file names. For example, we could just require that every config file name we use in (Markdown) Shell Recorder tests has to start with the text tests_.

A constant prefix might reduce the likelihood but in my case it would not have been helpful: all the cases I had up to now were leftovers from unsuccessful or aborted previous test runs.

Shellrecorder is the only place where we can give guarantees about files not being there and being cleaned up in the end.

鈥ll the cases I had up to now where leftovers from unsuccessful or aborted previous test runs.

In that case the second solution you proposed above:

  • the shell recorder prefixes the names of the config files

does not fix the problem either.

Depends on the prefix: mktemp or uuid should suffice for any practical purpose.

On my computer, some testcases again fail because of this problem. It is not so easy to find out which left-over file causes the problem. It would be great to see a fix here.

I had again this problem (~/.config/tutorial.dump) was present. It would be great if shell recorder could have better support to deal with this problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sanssecours picture sanssecours  路  3Comments

sanssecours picture sanssecours  路  4Comments

mpranj picture mpranj  路  3Comments

mpranj picture mpranj  路  3Comments

mpranj picture mpranj  路  3Comments