Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reedeveris/clean up testing 103 #106

Merged
merged 1 commit into from
Mar 25, 2024
Merged

Conversation

StoneyJackson
Copy link
Member

@StoneyJackson StoneyJackson commented Mar 4, 2024

test: isolate tests from each other

---

Closes #103 

@StoneyJackson
Copy link
Member Author

@reedeveris Hmm... getting an error. It looks like it's trying to create a directory in a location that it doesn't have permissions to do that.

@StoneyJackson
Copy link
Member Author

@reedeveris Looks pretty good.

I think we should be using $BATS_TEST_TMPDIR. According to https://bats-core.readthedocs.io/en/stable/writing-tests.html it is unique for each test.

If we do, Bats might cleanup this directory for us and we don't need a teardown.

Maybe we should have a setup that copies the files over to $BATS_TEST_TMPDIR prior to each test. I wonder if it can also reposition the current working directory into $BATS_TEST_TMPDIR (i.e., cd $BATS_TEST_TMPDIR). It may not. Worth a try?

Sorry for the extra work. But I think it's worth getting this right because it's going to be around for a while.

@StoneyJackson
Copy link
Member Author

@reedeveris I'm about to go into some meetings, and I have a number of other things I have to get done before I can circle back to this. So here is what I learned and maybe this will give you some ideas.

So the reason some of the variables (listed here https://bats-core.readthedocs.io/en/latest/writing-tests.html#special-variables) are empty is because we are using an older version of bats.

We are installing bats using apt-get. And it's giving us 1.2. The current version is 1.10 (!!!).

These instructions https://bats-core.readthedocs.io/en/latest/installation.html tell us how to install from source. Using this approach, we can install whatever version we want.

The trick is how to do this consistently across environments/containers. My current thought is to make a script that installs bats using whatever method we choose. Then call this script from Dockerfiles, .gitpod.yml, etc. That way we can easily update the version of bats whenever we like.

@reedeveris reedeveris force-pushed the reedeveris/clean-up-testing-103 branch from bbbd403 to 8ba4966 Compare March 18, 2024 23:47
@StoneyJackson StoneyJackson merged commit 47f2c5d into main Mar 25, 2024
4 checks passed
@StoneyJackson StoneyJackson deleted the reedeveris/clean-up-testing-103 branch March 25, 2024 16:59
Copy link

🎉 This PR is included in version 6.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants