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

Don't update dependencies more than once #132

Merged
merged 3 commits into from
Jun 7, 2020
Merged

Don't update dependencies more than once #132

merged 3 commits into from
Jun 7, 2020

Conversation

SeanTAllen
Copy link
Member

@SeanTAllen SeanTAllen commented Jun 7, 2020

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

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.
@SeanTAllen SeanTAllen added changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge triggers release Major issue that when fixed, results in an "emergency" release labels Jun 7, 2020
@SeanTAllen SeanTAllen requested a review from JONBRWN June 7, 2020 10:49
@SeanTAllen
Copy link
Member Author

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.

@SeanTAllen SeanTAllen requested review from jemc and Theodus June 7, 2020 10:59
It's very ugly and there's a lot of design work that needs to do.
let recorder = _OpsRecorder(h, 4, 4, 4)
let vcs_builder: VCSBuilder = _TestCmdUpdateVCSBuilder(recorder)

// when
Copy link

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?

Copy link
Member Author

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.

Copy link

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

@SeanTAllen SeanTAllen merged commit a4901a6 into master Jun 7, 2020
@SeanTAllen SeanTAllen deleted the 120-fix branch June 7, 2020 12:34
github-actions bot pushed a commit that referenced this pull request Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge triggers release Major issue that when fixed, results in an "emergency" release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Corral update error
2 participants