Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Ensure unit tests can find test data (#15). #70

Closed
wants to merge 1 commit into from

Conversation

bradh
Copy link
Contributor

@bradh bradh commented Apr 16, 2017

I considered adding a symlink, but since the tests create files in the test data directory, a copy seemed safer.

# Drop in the test data
fusiontestdir = os.path.join(testdir, 'fusion')
shutil.rmtree(fusiontestdir, ignore_errors=True)
shutil.copytree('../../fusion', fusiontestdir)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems will copy src/fusion to ${bin}/tests/fusion? Why do we need this?
I couldn't find an issue for this fix,
Can you please add an issue, so it will be easier to figure out what this fix is for?
Thanks.

Copy link
Contributor Author

@bradh bradh Apr 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is issue #15 - the tests look for data in that location.

Copy link
Contributor

@andreisel andreisel Apr 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.
I believe you need to copy only src/fusion/testdata.

Another solution could be updating tests to report more informative message that test needs to be run from src-dir...

Copy link
Contributor Author

@bradh bradh Apr 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build instructions (https://github.com/google/earthenterprise/wiki/Build-Instructions#building-earth-enterprise-fusion-server-on-ubuntu-1404-lts-and-rhel-7) say to run it from the build dir.

If you run from the source root, you'll end up with some test products in the source dir (rather than the build dir). That is messy (pollutes git, which could be overcome with .gitignore) and might be an issue for building on multiple architectures when we get to that stage.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little torn on this issue. On the one hand, it seems more natural to run the tests from the build directory instead of src, and I certainly don't want to keep track of a bunch of random temp files in .gitignore. But, on the other, copying all the test data can end up taking up a lot of space. I think ideally we would read the data out of the source data but keep the working directory under /bin/tests. I'll leave this up to you, @bradh, how much more effort you'd like to put into it. But, I do agree with @andreisel that we should minimize the data that is copied by limiting to the testdata directory if possible. It's 113MB for testdata vs. 317M for all of fusion.

# Drop in the test data
fusiontestdir = os.path.join(testdir, 'fusion')
shutil.rmtree(fusiontestdir, ignore_errors=True)
shutil.copytree('../../fusion', fusiontestdir)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little torn on this issue. On the one hand, it seems more natural to run the tests from the build directory instead of src, and I certainly don't want to keep track of a bunch of random temp files in .gitignore. But, on the other, copying all the test data can end up taking up a lot of space. I think ideally we would read the data out of the source data but keep the working directory under /bin/tests. I'll leave this up to you, @bradh, how much more effort you'd like to put into it. But, I do agree with @andreisel that we should minimize the data that is copied by limiting to the testdata directory if possible. It's 113MB for testdata vs. 317M for all of fusion.

@bradh
Copy link
Contributor Author

bradh commented Apr 18, 2017

As discussed on slack, a better solution would be to do the mkdir() for fusion/testdata then just link in the data. While unlikely, builddir and srcdir may be on different mounts, so a symlink would probably be safest.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants