-
Notifications
You must be signed in to change notification settings - Fork 103
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 integration tests for InstanceController #504
Add integration tests for InstanceController #504
Conversation
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.
This looks great!
Some thoughts:
- We should decide on how we want to document our tests. We could do either a README.md in each test case’s directory or comments in the file or something more structured. That is probably a decision for outside of this PR/a KEP, though.
- I should update the harness to allow merge patching in the updates to make these more DRY.
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.
Looks good!
Just one note - I think this should be e2e tests not integration tests. We already have integration tests for controllers and it's different level that this one - it's confusing then.
As much as I like the simplicity of the harness, there are things that worry me. In general I am just worried that all this is not code so it will be real pain to do any kind of refactoring in that :( Like lots of the strings are hardcoded... We'll see :) I am just not a big fan of maintaining a lot of YAML. Also to see what are the steps actually doing you have to read A LOT of yaml across several files. So to get some overview, it's also pretty hard.
@alenkacz Im definitely all ears on suggestions on how we can improve it. |
Also these are integration tests: https://github.com/kudobuilder/kudo/blob/master/keps/0004-add-testing-infrastructure.md#integration-tests We could change that on the KEP, but I think the tests you’re talking about are more likely to be unit tests - or just also integration tests. |
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.
Nice work. Just had one question about the TestStep
foo: "new value" | ||
--- | ||
apiVersion: kudo.k8s.io/v1alpha1 | ||
kind: TestStep |
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.
What's a TestStep
? A debug remnant?
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.
Here's Justin's definition of TestStep
from the corresponding KEP:
When searching a test step file, if a TestStep object is found, it includes settings to apply to the step. This object is not required - if it is not specified then defaults are used. No more than one TestStep object should be defined in a given test step.
In this case I'm using the TestStep
object to make the test harness delete the first deploy PlanExecution
.
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.
Got ya!
Changing the name of the PR back to |
I echo that but I guess we'll see how maintainable that will become. In the meantime, it is somewhat hard to identify/follow what behavior is supposed to be tested. I'm missing something like Scala's
So maybe we could put these as YAML comments for now? Wdyt @gkleiman , @alenkacz , @justinbarrick ? |
@zen-dog yeah, I think YAML comments are the way to go at the moment. I'm not sure what you're hoping for with the Given/When/Then/And thing, just documentation? We do have these in practice when you define your steps and asserts, it's just a matter of how we want to structure and document them. |
test/integration/instance-controller-param-change/00-assert.yaml
Outdated
Show resolved
Hide resolved
That and better understanding of individual steps and asserts. E.g. here, we have 3 test cases (with custom |
@justinbarrick I was thinking about it over weekend. I was leaning towards having a 'root' yaml per test case, where you would define steps and maybe some comments. Then if people write that in a meaningful way it would be easier to get a high-level overview of what is that particular test case doing |
@alenkacz Agreed! I'll spec something out on the KEP. |
@alenkacz , @jbarrick-mesosphere: in the meantime I added some comments to the first step of each test. Let me know whether you like them =). |
test/integration/instance-controller-param-change/00-assert.yaml
Outdated
Show resolved
Hide resolved
@jbarrick-mesosphere I split the upgrade and param change tests out into smaller tests. Please take another look =). I think it would be nice if we could nest all the upgrade/param-change tests within parent directories to make it obvious that they're related. |
I like the nesting idea a lot, I’ll have to spec that one out too. |
What type of PR is this?
What this PR does / why we need it:
This patch adds integration tests for
InstanceController
, which will enable us to ensure that we don't change the existing behavior when cleaning it up and when working on #422.Does this PR introduce a user-facing change?: