-
Notifications
You must be signed in to change notification settings - Fork 2k
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
build: follow up fixes for build stream #300
Conversation
There's another one or two places where this buffer is printed I believe. I have the buffers fixed in #294. |
Codecov Report
@@ Coverage Diff @@
## master #300 +/- ##
==========================================
- Coverage 50.1% 50.09% -0.02%
==========================================
Files 216 216
Lines 17700 17703 +3
==========================================
- Hits 8869 8868 -1
- Misses 8387 8391 +4
Partials 444 444 |
ping @tonistiigi @dnephin what's the status on this one? |
I prefer the solution in #294 |
I didn't notice that this got stuck. This is not a refactor but fixes |
Sure, that's possible. This PR has no tests, so I'm not sure how confident we can be that it still fixes the problem. |
ping @tonistiigi is it possible to add a test for this PR? |
(or go for #294 if you think that's better) |
@thaJeztah This behavior should be tested with e2e/integration test. So not atm(or any more) afaik. I repeat that this is a fix for a bug still existing in |
I disagree. The bug was not in the integration of components, it was in a single component, which means it can be unit tested, if the code is structured properly. There is an e2e suite in docker/cli https://github.com/docker/cli/tree/master/e2e, but writing a e2e test for every minor bug is not a sustainable way of testing software. |
The bug is in no component. The bug is in the cli wrapper so the test needs to use the cli. Implying that these cli unit-tests with mocks actually catch any bugs is something I can not agree with and to my knowledge has become evident in almost any time cli and engine are combined in Feel free to close, as it shouldn't take 3 months to merge a fix for not printing |
I'm not sure what you mean by "cli wrapper". The bug is in the cli binary, which is a component of a larger system. This bug wasn't with the integration of components, it was internal to a single module, so doesn't need a binary with an API to exercise the bug.
Unit tests will not catch integration errors, that's true. That's not their purpose. Their purpose is to validate that a unit behaves correctly. In this case the unit is a module in the cli repo. Integration and e2e test are also important, but when every test is written in that style is causes many problems. Integration and e2e tests should test integration of components, and end user features, not internal logic of a module.
Yes, there are plenty of missing tests in Considering that test coverage is barely 50% I'm actually surprised that we average fewer than 1 integration bug per release. |
Signed-off-by: Tonis Tiigi <[email protected]>
Signed-off-by: Tonis Tiigi <[email protected]>
b8a4e0c
to
0747b8c
Compare
I've added another commit to open Dockerfile from correct location.
End user feature is broken. You can't build with certain flags.
The examples were from regressions in the old code that happened to have tests before 17.03. It is very hard to assume anything about the number of bugs in new features as like this one they are only discovered by manual testing after release is out. |
Yes, every bug would impact some user feature, that's almost the definition of a bug. Are you arguing that there is no place for unit tests, and that every test must exercise the system end-to-end to be of any value? I don't really understand how anyone could make that argument.
Which is exactly why I've been asked for test coverage, so we don't have to assume. |
No. There are many cases where unit tests work great. When there is an isolated component with features specific to that component that can be tested (in most cases, you need both types). This is not a case in here as only thing this code does is take cli flags, process them and form cli output from daemon response. Taking a substep of that and creating mocks to provide an expected result just means that same code is written two times and doesn't provide any guarantees that it actually works or discovers bugs when some other component changes. I think we have plenty of data to support this.
If the tests are not actually testing anything the test coverage has no correlation to the number of bugs we ship. I'm sorry for falling into this tirade, but I'm getting frustrated for the constant reports showing up from end users for different build features(because there have been many new features and refactoring prs). Almost all of them fall into a category that would have been impossible 6 months ago when we had tests for the actual features of the platform and never merged anything without a feature test and all of the test suites passing. Not to mention people making the changes actually tested them with code shipping with |
Unit tests do not test product features! They test units of code. If you are testing features then it's not really a unit test. So it does sound like you would only like tests that exercise end user features. While I agree it is important to have end-to-end feature tests, I think unit tests are equality important. They allow developers to get quick feedback on changes they've made, and give important signals about code structure and interfaces. Without unit tests the architecture can quickly devolve into a big ball of mud. The cost of units tests, both in developer time and infrastructure to run the tests is also much lower. There are plenty of other benefits to unit tests that can fill a book.
That is true for some cli commands, however the build command has over 1200 lines of code in
That's right, it doesn't catch any regression caused by changes to the API. That is not the purpose of a unit test. There definitely need to be end-to-end tests as well. There is no duplicate code. The fake is generally one or two lines that builds a static object. If the API was as simple as sending a static object then there wouldn't be much value in the API. The guarantee that it provides is that the unit performs correctly given a specific input. This bug was not an integration bug. It can easily be reproduced with specific static input.
I haven't seen any data to support this. You mentioned two issues, so lets look at those 2 issues:
If you have other cases that you believe demonstrate the issue, we should discuss this further.
I understand your frustration. We made a large change (splitting the repos) and never invested the effort to actually finish the transition. We are making progress in the right direction. We have an e2e test sutie in this repo which allows us to test against a real daemon, but there are still plenty of tests that need to be ported.
It sounds like your disagree with the testing philosophy used in this repository, and your protest is not writing a unit test for the bug. That is certainly your right, but I think it would also be expected that it would delay, and possibly even prevent the merging of this PR. You could contribute an e2e feature test in However, I still maintain that the bug this PR is fixing would have been caught by a unit test. The bug can be exercised without even hitting the API, so an e2e test to catch this issue does not make sense. |
Absolutely, but I'm not trying to rewrite these 1200 lines. I'm trying to fix a bug. In first commit, the bug is printing
I didn't mean that the mock is a duplicate, but that the tests don't test a behavior but follow the implementation. This does not apply in cases where there is a testable unit, but cases, where there isn't one, but unit-test is used to cover a specific implementation line that changed. For the data, I meant data on that our test coverage/quality has gone down. That is based recollection that every Both of the issues you mentioned had plenty of coverage in
I'll do that. |
@tonistiigi have you had time to look at adding a test in e2e/image/build_test.go ? |
@thaJeztah I still plan to do it but don't know when. I didn't notice that there were no cases that cover building in |
Opened #709 which adds an e2e test for |
ping @dnephin @tonistiigi what is the status here ? 👼 |
Just needs a test |
Addresses the follow-up comments in #231 (review)
For the content-trust update, I have no idea why the
FROM
images should be retagged by the builder. I would argue that this is wrong but made it match the non-stream behavior.@dnephin
Signed-off-by: Tonis Tiigi [email protected]