-
Notifications
You must be signed in to change notification settings - Fork 118
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
Run integration tests with ginkgo instead of go test and ensure logs go to GinkgoWriter instead of stdout #1726
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
package test | ||
|
||
import ( | ||
"io" | ||
"path" | ||
|
||
"github.com/istio-ecosystem/sail-operator/pkg/common" | ||
|
@@ -26,8 +27,8 @@ import ( | |
"sigs.k8s.io/controller-runtime/pkg/log/zap" | ||
) | ||
|
||
func SetupEnv() (*envtest.Environment, client.Client, *rest.Config) { | ||
logf.SetLogger(zap.New(zap.UseDevMode(true))) | ||
func SetupEnv(logWriter io.Writer) (*envtest.Environment, client.Client, *rest.Config) { | ||
logf.SetLogger(zap.New(zap.WriteTo(logWriter), zap.UseDevMode(true))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Funny story, in Brazil, "zap" is a short for "Whatsapp", the messenger app. |
||
|
||
testEnv := &envtest.Environment{ | ||
CRDDirectoryPaths: []string{path.Join(common.RepositoryRoot, "chart", "crds")}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
just tried this locally and the output is too much verbose. :(
also, does this run ginkgo from master? This might break us at some point? Should we stick to a released version instead?
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.
Yup, too much output due to a bug: https://issues.redhat.com/browse/OSSM-6159
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.
As for running ginkgo from master. We use the same approach in the e2e tests. So if this need to be fixed, we should do it in both places (in a follow up PR).
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.
Actually, it looks like
go run
honors whatever is in go.mod, so we're actually running v2.15.0: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.
@jwendell I've just pushed another commit that fixes the logs.
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.
Yeah, I agree, but as you say: "it is what it is" :)
Ginkgo has "specs" not tests. The list of specs gets built from a hierarchy of test "nodes". These specs are then executed (in a single test function that you must write). Unlike functions that are organized into packages, the specs are just one giant sequential list. And they are all executed by your test function.
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 see. Is there a way to show the progress a little more verbose, instead of just showing small dots?
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 don't think so. There's only
-v
, but this displays everything that is logged by the test. I don't see any other option that would e.g. only print the specs with nothing else.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.
ok. It is what it is, should we revert to using plain old go tests then? /me runs :D
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.
We wouldn't be reverting. We had ginkgo tests from the very start. :)