-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Don't update dependencies more than once #132
Conversation
As part of the work on #120, an error when using the update command, I wanted to add tests to demonstrate the bug and then show that the bug was fixed by my changes. This is problematic because there are no real unit tests for any commands. This commit is the first step in providing better unit testability of various parts of corral in general and commands specifically. The only test added by this commit is that when using a corral.json with empty deps, that no VCS operations will be executed by _Updater. There are a number of changes that are brought in my this initial refactor. As we move forward with making corral more testable, some of these changes will probably fall away. I did what I considered the minimal thing to get a harness for testing _Updater working. This harness should be enough to test using the various test-data bundles that we have as well as testing issue #120. The approach I have taken does leave a lot of things in an inconsistent state. For example, this commit introduces a new way of organizing unit tests that keeps said tests near the code they are testing and allows for testing private implementations like the _Update that is part of the update cmd. These inconsistencies are temporary and as we move forward with adding more tests, will start to fall away.
This PR needs to be squashed and the top level GH comment should be used as the body of the squash and the PR title should be the commit title. |
let recorder = _OpsRecorder(h, 4, 4, 4) | ||
let vcs_builder: VCSBuilder = _TestCmdUpdateVCSBuilder(recorder) | ||
|
||
// when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment intended to be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes...
There's also a "given" above before the setup so Given this setup, when Blah...
from a given, when, then style.
If you think it is confusing, I can remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can stay, since I don't think it would hinder anyone's understanding of the test
Prior to this commit, when update would run, if there were transitive dependencies, it might try to fetch/update them more than once potentially leading to errors.
This commit adds a regression unit test that shows the problem and a simple fix to the _Updater to handle. I use "simple" to mean "small" or "baby-steps". The internal design of _Updater needs to be examined in more depth in order to make this all better.
I'm not tackling that now. Before getting into design, we need to add more tests in general to see what affordances for insight and tracing that corral needs to provide then we can build the design around that.
I wanted to add tests to demonstrate the bug and then show that the
bug was fixed by my changes. This was problematic because there are no real unit tests for any
commands.
This PR includes a first step in providing better unit testability
of various parts of corral in general and commands specifically.
There are a number of testing-related changes that are brought this PR.
As we move forward with making corral more testable, some of these changes
will probably fall away. I did what I considered the minimal thing to get
a unit-test harness for testing _Updater working.
The approach I have taken does leave a lot of things in an inconsistent state.
For example, this PR introduces a new way of organizing unit tests that keeps
said tests near the code they are testing and allows for testing private implementations
like the _Update that is part of the update cmd.
These inconsistencies are temporary and as we move forward with adding more tests, will
start to fall away.
Closes #120