-
Notifications
You must be signed in to change notification settings - Fork 569
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
Add tests for create source git #1696
Conversation
e2ca618
to
f61b91e
Compare
create source git
f61b91e
to
82c06d0
Compare
@chanwit as an FYI |
Thank you, Alen.
…On Sun, Aug 8, 2021, 1:51 AM Allen Porter ***@***.***> wrote:
@chanwit <https://github.com/chanwit> as an FYI
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1696 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAACTKWAZB2AEGLIUJ6RHDTT3V6ELANCNFSM5BXAXKOA>
.
|
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.
LGTM, and seems to be indeed the fix for the other test-related PR :-)
24850ac
to
9ede6e0
Compare
@hiddeco i'm having trouble merging this with the e2e tests that were just added. Do you have a workflow for running the e2e tests with extra logging enabled? My iteration cycle is pretty high having to wait for github actions to run -- or perhaps you can lend a pair of eyes and spot if i added a bug. |
@chanwit @stefanprodan anything standing out from the PR that got merged into |
We can’t use the install test, I’m dropping it, PR will follow. |
Please see #1721 |
@allenporter @hiddeco @chanwit I'm for dropping the mock API and use envtest. |
No objection @stefanprodan |
In the latest controller-runtime release, the testenv startup time has improve a lot, I think we need to port the |
9ede6e0
to
29d6646
Compare
1: On Testenv Great, as I mentioned up on the other PR, having fewer test environments would be ideal if its speedy. Now that the e2e and unit tests share the same harness, but not the same setup, it seems easy to accidentally break the e2e tests while iterating on the unit tests, so removing the differences would be nice. @chanwit hav you exercised
2: On running e2e tests, back to my question above: Do you have a workflow for running the e2e tests locally? I'm having difficulty telling if the e2e tests are still flaky or i'm breaking it. I'm assuming they are still flaky given the error messages are related to deadline exceeded. I don't seem to be able to 3: Stepping back: The approach in this PR is to be able to support more complex test types to be able to exercise edge cases such as waiting for the results of a controller to run. I keep seeing more PRs coming in adding tests with the old harness in parallel with this so I'd like to make sure this is useful before doing more catchup. Is this a useful direction or should I abandon this? |
29d6646
to
fcf2e64
Compare
I think the new direction (yours) is more useful and we should probably look into transforming the others. |
OK if we get the unit tests using testenv then maybe there will be less of a distinction between the two scenarios and we can leave a few e2e tests. |
fcf2e64
to
8d9cba4
Compare
Looks like the client is not wired correctly now, no types are registered. |
Correct -- the changes to the test harness to support the e2e end test have broken the fake harness wiring via More detail:
I'll start unwinding this... |
0b432dd
to
4ee18da
Compare
Replace the 4 arguments to cmdTestCase with a function that can let tests run arbitrary logic if it is more complex than what is provided by the test harness. Move the existing logic into functions that the test can use for common checks on golden files and golden values. These changes were pulled out of PR fluxcd#1696 to make a smaller review. Signed-off-by: Allen Porter <allen@thebends.org>
Replace the 4 arguments to cmdTestCase with a function that can let tests run arbitrary logic if it is more complex than what is provided by the test harness. Move the existing logic into functions that the test can use for common assertions on golden files and golden values. These changes were pulled out of PR fluxcd#1696 to make a smaller review. Signed-off-by: Allen Porter <allen@thebends.org>
4ee18da
to
25d27a1
Compare
25d27a1
to
6e5d39c
Compare
8200ac3
to
4d0a1e8
Compare
The create source tests are more interesting than the existing tests as they create objects then wit for the flux source reconciler to complete. The tests simulate this with a background goroutine that waits for an object to be created then uses a test specific function to update it. The tests set a timeout so that if there is a failure they timeout somewhat quickly rather than hanging for a longer period of time. Signed-off-by: Allen Porter <allen@thebends.org>
4d0a1e8
to
8cbd4e8
Compare
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.
LGTM, thank you @allenporter 💯
Replace the 4 arguments to cmdTestCase with a function that can let tests run arbitrary logic if it is more complex than what is provided by the test harness. Move the existing logic into functions that the test can use for common assertions on golden files and golden values. These changes were pulled out of PR fluxcd#1696 to make a smaller review. Signed-off-by: Allen Porter <allen@thebends.org>
Add unit tests for
create source git
.The create source tests are more interesting than the existing unit tests as they
create objects then wait for the flux source reconciler to complete. The tests
simulate this with a background goroutine that waits for an object to be
created then uses a test specific function to update it. The reconciler was
implemented assuming that it might be possible to make it more generic
in the future if needed by additional tests.
The tests set a timeout so that if there is a failure they timeout somewhat
quickly rather than hanging for a longer period of time.
Issue #1603