-
Notifications
You must be signed in to change notification settings - Fork 113
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
Introduce integration-tests framework #391
Introduce integration-tests framework #391
Conversation
a0b1d20
to
91fa1a4
Compare
82803ce
to
e83c066
Compare
9a0f7d2
to
9faab5f
Compare
558db0c
to
276fb75
Compare
|
||
It("should fail the builRun with a Reason", func() { | ||
|
||
Expect(tb.CreateBuild(buildObject)).To(BeNil()) |
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 do not really have a strong opinion on this, but I like to use HaveOccurred()
for an Expect
where I know the return value is an error, mostly for readability.
Expect(tb.CreateBuild(buildObject)).To(BeNil()) | |
Expect(tb.CreateBuild(buildObject)).ToNot(HaveOccurred()) |
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.
Now that I read the suggestion when it is rendered here, it actually reads more confusing with ToNot
HaveOccurred
.
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.
Would be interested in other feedback on this. I am fine with BeNil
here.
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 think I was doing this based on the typical go code block that looks like:
if err != nil {
}
Im fine keeping it the way it is.
@@ -102,8 +100,13 @@ func main() { | |||
} | |||
defer r.Unset() |
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.
To be fair, it is very edge case, but it triggered me a little to see a defer
in the same function with an os.Exit()
. See https://stackoverflow.com/questions/27629380/how-to-exit-a-go-program-honoring-deferred-calls for a discussion 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.
If is fine for you, I will leave it like this for now.
The whole Ready
interface usage will go away once we bump the sdk, because is a package they do not longer have. Once we do this update, we can refactor the above to ensure the defer can work with the os.Exit.
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.
Finally got around to look through the many changes in this PR. There are a couple of function names I would like to see using the full name, because that seems to be common schema. Other than that, it does look like a nice addition to the tests to me.
2e0e385
to
1974c60
Compare
6997c5c
to
d1922e5
Compare
3bd3d9d
to
72b97cf
Compare
This generates a new type of test to validate all the different integrations between all components that take place during a build: - builds to buildruns - buildruns to taskruns - resources like secrets and sa to builds and buildruns This framework will generate for each test spec: - an instance of the build operator - a namespace to run the test - a set of resources to test - cleans the resources and namespace after the test is finish To run the integration test you only need: - cluster - tekton controller installed - run make test-integration
These are needed for generating tekton pipeline objects during integration tests. We might use this for e2e in the future. The vendor update only includes: - tekton clientset dependencies
I needed to refactor the whole docs for testing, and introduced a new testing specific document that containts all related information around the three types of testing we now have.
cb96876
to
7beb5c8
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
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: HeavyWombat, qu1queee The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #322 and #292
Add test-integration framework. This was the last missing testing level from our side, based on kubernetes sig-testing. This should allow developers to get more confidence in upcoming PRs. Ideally you want a PR to at least pass unit-tests and integration-tests.
Running integration-tests is very simple, is just a single Make target call, no need to set environment variable or similar, only requirement is a k8s cluster and tekton installed. This also should simplify what e2e tests is currently testing, now e2e tests should be only one assertion around if the image was successfully build or not. I added documentation, which explains more in detail everything.
This PR contains 5 commits, first commit contains the main logic, the other commits are generated clients, vendor packages , documentation and one more commit to address fixes on the pr. I recommend to click on each commit to simplify the view of the changes.
integration test generates a new type of test to validate all the different integrations between all components that take place during a build:
and any other interaction one can think of.
This integration framework is implemented on the following way:
The above implementation is based on https://github.com/kubernetes/community/blob/master/contributors/devel/sig-testing/integration-tests.md
This framework requires to generate:
To run the integration test you only need:
For e2e tests: