-
Notifications
You must be signed in to change notification settings - Fork 104
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
Implementation of framework test harness (KEP-0008) #285
Implementation of framework test harness (KEP-0008) #285
Conversation
2503069
to
edde8b7
Compare
I don't think I'm causing these test failures:
|
You don't and we are getting rid of the Github Client and its test, so don't worry about it. |
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.
- One comment to explain the difference between teststage vs testcase, specifically why is it called teststage in the README itself.
- Couple of minor refactor comments - This can be addressed if it is agreed upon by KUDO maintainers.
Thank you! LGTM.
keps/0008-framework-testing.md
Outdated
* `Test case`: a set of manifests to apply and the expected state. Test cases run sequentially within a Test. | ||
* `Assertion`: the expected state of a test case. | ||
* `Test`: a complete acceptance test, consisting of multiple test cases. Tests run concurrently to each other. | ||
* `Test stage`: a set of manifests to apply and the expected state. Test stages run sequentially within a Test. |
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.
Do you need to explain the relationship between test stage
and a test case
?
Why is it called a Test stage
instead of test case
which is a more common term?
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.
I decided to change it to stage specifically to differentiate it from the definition of case.
We have:
- Tests (we could rename these to test cases) which are the independent tests
- Test stages are parts of a single test. They get run sequentially and depend on the status of the previous one. The stages all form one test, so IMO calling them test cases is confusing.
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.
FYI, In other worlds, the nouns are TestSuite
, TestCase
, and test
.
The shared understanding is:
Test Suite is comprises of Test Cases which comprises of Tests.
Test stage is a new term. If we agree to adopt it, it is fine. (Test stage seems like a single test function).
A test case defines the fixture/class to run multiple tests.
http://junit.sourceforge.net/junit3.8.1/javadoc/junit/framework/TestCase.html
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.
How about:
- Test Harness: the thing that runs a test suite.
- Test Suite: the collection of all test cases.
- Test Case: a single, self contained test - can be run in parallel to other test cases.
- Test Step (or TestStage, but I thought of TestStep last night and it seems maybe even more clear): a portion of a test case indicating a state to apply and expect, dependent on all previous test steps in the test case being successful.
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 sounds much better to me. Does not need any further explanation as it goes along with what is commonly well understood.
"Stage" is a term also used the building software where there are dependencies and ordering between stages.
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.
A bit late to this conversation but when reading through it I want to also maybe add some idea or perspective. Imo it reminded me a bit on the hierarchy and naming established within Phases. So just something that maybe spark some good thoughts:
TestPhase
for Test Suite if aligned with how we think about the name and what a Plan
is here https://github.com/kudobuilder/kudo/blob/master/keps/0009-operator-toolkit.md#plans ?
TestStep
for Test Case if aligned with how we think about the name and what a Step
is here https://github.com/kudobuilder/kudo/blob/master/keps/0009-operator-toolkit.md#steps ?
TestTask
for Test Step if aligned with how we think about the name and what a Step
is here https://github.com/kudobuilder/kudo/blob/master/keps/0009-operator-toolkit.md#tasks ?
Maybe I am entirely wrong here and this won't work, again just a thought!
Note: we’ll also integrate this into kudoctl in a follow up PR. |
This also does not yet fully implement the design as laid out in the KEP. In follow up PRs, we’ll add:
|
An open question: right now, if you provide the flags to install CRDs or manifests prior to running the tests, it will bail out if any of the resources already exist. I have not decided the safest way to handle this case. We could:
|
OK I re-read the KEP and did one initial pass in the PR. I did not really focus on the golang code yet, so I am not submitting a review right now. But in general this feels like very generic test framework for kubernetes. Shouldn't it at least live in a separate repo? the only thing that relates it to kudo is pretty much this, right? https://github.com/kudobuilder/kudo/pull/285/files#diff-426fa14ee729b01f7853a36a1e8542aeR224 EDIT: Or do we plan to use this even for integration testing the base tech (kudo?). The KEP was not really clear on that |
We can use this to test the controller as well as frameworks, so yeah it’s already intended to be used in two repositories. I could definitely see it being useful for other projects (in and outside of Mesosphere), so a separate repository definitely makes a lot of sense to me. I’m not sure what the other kudo contributors think about that, though, as right now kudo has total control over the design and I’m not sure how much moving it to a different repository would affect that. |
Rename Test to Case, rename Stage to Step. Fix race if a resource is updated externally while the test harness is updating the resource. Migrate InstallManifests into utils.
8dc7480
to
bab8113
Compare
Rebased. |
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, Lets get this in and start using it!
What type of PR is this?
/kind feature
What this PR does / why we need it:
This implements the framework test harness specified in KEP-0008.
Which issue(s) this PR fixes:
Fixes #284.
Special notes for your reviewer:
This PR is rather large, but it is mostly self contained and spiking on a new component, so this is expected.
I've put together a demo of this working to help reviewers understand what is happening: https://asciinema.org/a/249814
This is also specified in KEP-0008: https://github.com/kudobuilder/kudo/blob/master/keps/0008-framework-testing.md
We'll add full user documentation in a second PR (and improve the CLI interface), but to try this out:
Also see the help message:
Does this PR introduce a user-facing change?: