Skip to content
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 log verification to integration tests #119

Closed
aaron-prindle opened this issue Oct 9, 2018 · 3 comments
Closed

Add log verification to integration tests #119

aaron-prindle opened this issue Oct 9, 2018 · 3 comments

Comments

@aaron-prindle
Copy link
Contributor

aaron-prindle commented Oct 9, 2018

Expected Behavior

The integration tests should support viewing the logs for a Build containers invocation (Build -> hello world container -> container logs -> "hello world")

Actual Behavior

Currently we are unable to view the logs for a container that is created by Build as once the container exits, it's logs cannot be queried.

Possible Solutions

  • Use streaming logs and sleep in our examples so that we have time to verify that the output we want verified is there
  • Persist logs somewhere so that once the container exits we can still read them (GCS or a k8s PVC)
@bobcatfish bobcatfish added this to the Mid October Demo milestone Oct 9, 2018
@bobcatfish
Copy link
Collaborator

Related issue in knative/build about not being able to access logs: knative/build#232

@bobcatfish
Copy link
Collaborator

An even more related issue in knative/build: knative/build#9

knative-prow-robot pushed a commit that referenced this issue Oct 11, 2018
What is the problem being solved?
This pr addresses #119 which explains that the integration tests should support viewing the logs for a Build containers invocation.

Why is this the best approach?
The solution to get the logs for Builds in this pr relies on using PersistentVolume's.  A volume is mounted into the test Build, the BuildSpec container writes to the mounted volume, and then a verfication pod is run that also mounts this Persistent volume at which point the Build logs for the init container that Build spawned are now verifiable.

What other approaches did you consider?
- Use Stackdriver logs
Issues:
- Stackdriver can take >30 minutes to propogate logs in some cases so it is not feasible for integration test
- Stackdriver use would limit integration tests to only work on clusters with Stackdriver integration

What side effects will this approach have?
This test will require that all test Tasks that are verifiable only through stdout/logging have to write to disk as that is how we can read out the values for verfification.

What future work remains to be done
The approach of storing test information in a PersistentVolume is required currently as Kubernetes pod logs are not queryable in some cases one a pod succeeds.  If in the future kubernetes better supports these logs natively, we can change this to use the native logging again.  Also this should be refactored into an easier to use libray for future tests.
@bobcatfish
Copy link
Collaborator

Implemented in #133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants