Update service ps to be an API test#33684
Conversation
|
LGTM |
|
Given that this test is testing CLI functionality, but does not catch the bug in #32800 Is there an actual need to merge this? #32800 (comment) suggests rewriting to an API test (which won't do any testing here, as it's only consecutive calls to the same endpoint) Shall we close this PR and remove the test? |
|
If we have other test coverage for this endpoint I would agree we can just remove this test entirely. |
|
It looks like we don't have any other tests for this endpoint, so this will need to be converted to api tests. |
e18317e to
d2c42db
Compare
|
OK, this PR has been updated accordingly |
|
Is there an equivalent test in |
|
The test should exist in e2e soon. There is no equivalent in I don't think we should wait for those tests to exist before merging this and similar PRs. This test fails on the jenkins integration job because of changes to the CLI . Test coverage of the code in this repo remains the same after this change. We can't rely on tests in this repo to cover behaviour in another repo. |
I'm afraid I disagree.
So let's fix it instead of removing it.
We need some way of making sure that the CLI works against the daemon. Currently it's impossible to add tests that verify this, and removing existing tests will make the situation even worse. |
That's exactly what I did here! The fix is to make it an API test.
Yes we do. It is the responsibility of The daemon should only be responsible for preventing regressions. Using a client binary is not the right way to do that, it hides regressions. We need to write API tests that check expected responses. That said, the API test I wrote is terrible. I need to update it to expect an exact struct and raw bytes. |
The old test checks the behavior of |
That behaviour is in The test coverage of the system under test (the daemon) is exactly the same before and after this change (once I fix the assertion). The old tests checked behaviour outside of this repo, which is a bug in the tests, that is being fixed here. |
|
I'm not comfortable removing the CLI test until there is a valid replacement in docker/cli. |
|
I was wrong, there are actually unit tests covering this: https://github.com/docker/cli/blob/master/cli/command/service/ps_test.go What value does this test provide? It's testing with an arbitrary frozen version of the CLI. We already know this test is failing with the latest version of the cli. My first change was to update the test, but @thaJeztah correctly pointed out that it doesn't make sense to keep this test. It's not actually testing anything. |
|
This isn't ready yet. I want to update the test to assert the entire struct matches the expect struct, instead of just comparing ID. |
d2c42db to
2fe4769
Compare
|
I've updated the test to compare the entire service instead of just the ID. This is ready for review again. |
|
Failures look related; |
|
Hmm, yes it does, but I can't reproduce locally. |
|
I don't see any errors in |
|
ping @dperny @vdemeester could you have a look at this one; perhaps you have an idea |
|
Something changed, I'm only seeing the PPC test failure which is unrelated. |
|
oh! that's cool, I thought, well, let's try once more; looks like that resolved it, must've been fixed elsewhere then |
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
d959ed5 to
7edb25e
Compare
Signed-off-by: Daniel Nephin <dnephin@docker.com>
7edb25e to
6cd6d86
Compare
|
This has been updated again to move the API test to the new |
| os.Exit(1) | ||
| } | ||
|
|
||
| // TODO: replace this with `testEnv.Print()` to print the full env |
Removed cli tests (which were testing CLI behaviour) and replaced with an API test
Also update
LoadBusybox()to use the API instead of the cli