I’m quite new using common test
and I am trying to get rid of some absolute paths we have inside a test suite. The tests were working before because they were eunit and we run them in a custom way.
Imagine I have the following project structure to illustrate the situation:
.
├── apps
│ └── example
│ ├── src
│ └── test
│ ├── example_SUITE_data
│ └── example_SUITE.erl
└── extlibs
└── test_data
└── data.txt
The test data is in a git submodule (extlibs/test_data/
) and the hardcoded paths we currently have point to them.
I tried to create a relative symbolic link pointing to data.txt
inside the example_SUITE_data/
so I can later use ?config(data_dir, Config)
. Unfortunately, when I run the tests, the symbolic file is copied to instead of dereferencing the content of it. I’m also using rebar3 ct
, so the content is copied to the _build/tests...
and the symbolic link won’t work anymore because the relative path has changed. I suspect the result will be the same with ct_run
so ?config(data_dir, Config)
won’t work.
I’m looking for a way of telling common test
to dereference the content of the symbolic links (similar to cp -L
) or specify a different data folder that will be used globally for all the tests (extlibs/test_data
in this example). I couldn’t find anything similar in the documentation. Does anyone know if there is a way of doing it? Maybe common test
is not able to do that right now, should it have and option of dereferencing the symbolic links ?
Also, what is the best way of handling the situation when two test suites need to access the same test data but it is not wanted to copy the files twice to the different ..._SUITE_data/
folders? I’m thinking in the case where the files are a few MB and I don’t want to commit them twice.