Comments (2)
According to the k8s documentation, we can use CoreV1Api's read_namespaced_pod_log to get logs of the specified Pod/container.
Here is an example of blackbox's leader logs:
time="2018-09-14T13:53:31Z" level=debug msg="[poller] re-scanning synse server"
time="2018-09-14T13:53:31Z" level=debug msg="[poller] reading device: &{rack-1 vec 12835beffd3e6c603aa4dd92127707b5}"
time="2018-09-14T13:53:31Z" level=debug msg="[poller] reading device: &{rack-1 vec 34c226b1afadaae5f172a4e1763fd1a6}"
time="2018-09-14T13:53:31Z" level=debug msg="[poller] reading device: &{rack-1 vec 12ea5644d052c6bf1bca3c9864fd8a44}"
time="2018-09-14T13:53:31Z" level=debug msg="[discovery] found service endpoint address" addr="10.16.7.11:5000" portName=http targetRef=synse-server-5bbb476b66-42cr8
time="2018-09-14T13:53:31Z" level=info msg="[discovery] discovery complete" results="[10.16.7.11:5000]"
time="2018-09-14T13:53:31Z" level=debug msg="[discovery] updating addresses" addrs="[10.16.7.11:5000]"
time="2018-09-14T13:53:31Z" level=debug msg="[discovery] done update at 2018-09-14 13:53:31.713162134 +0000 UTC m=+35140.018947679"
time="2018-09-14T13:53:31Z" level=info msg="[client] updated current address" address="10.16.7.11:5000"
time="2018-09-14T13:53:31Z" level=debug msg="[poller] reading device: &{rack-1 vec bcf0618c50bff9121cb10d141d66f46f}"
It follows the format
time=<timestamp> level=<logging_level> msg=[<component>] <component's log>
Here are some matching strategies that I can think of:
- Filter out the log by component, parsing them properly then verify against our mocked data.
- Save/Parse the output to a file and compare/diff with our mocked one. If the diff is less than X, say 10%, then it would be considered successful.
- Have a set of possible keywords and only check against them. For example,
isLeader=true
,[poller] synse server reads complete
,[postgres] adding new readings
,...
from kubetest.
I think the first two parse strategies could be tricky, namely because we won't be able to reliably mock out log data (I don't think we can reliably determine the order that certain things will run). Even if we measure closeness of the diff to within some percentage, I'm not sure that would buy us a whole lot for the amount of work that would take.
The last solution is probably the best because its the simplest. We can expand on it later as we see a need, but I think just being able to check for various states (like, isLeader=true
or synse server reads complete
) would be enough to verify that certain components are behaving how we expect.
For the first case, simple existence should be fine, e.g. "is isLeader=true
found anywhere in the logs?". Eventually, we may need to consider how to search for reoccurring log messages (e.g. "check that it had isLeader=false
first, then after election it was isLeader=true
). That would be much further down the line though.
from kubetest.
Related Issues (20)
- Endpoints is_ready() fails on ready endpoint
- Interest in asyncio support? HOT 2
- Security issue HOT 2
- Setup Kubernetes resource for running tests against HOT 10
- CI is not publishing releases to pypi
- Clusterinfo fixture fails with KUBECONFIG-defined config file location
- unknown version warning
- Wait for pod ready if created by TestClient
- kubernetes.client.exceptions.ApiException: (403) Reason: Forbidden
- How do I get the namespace name in which the test is running? HOT 1
- OpenShift Support
- Getting replicasets via the TestClient does not work
- Support for editing a deployment ?
- Provide TestClient.load_job()
- Fails with missing AppsV1beta1Api attribute when using new kubernetes python client HOT 3
- Unable to determine type when creating Ingress resource (apiVersion==networking.k8s.io/v1)
- RbacAuthorizationV1alpha1 deprecated from kubernetes v1.22 onwards - pytest fails with AttributeError HOT 6
- Document support matrix for kubetestl and kubernetes client versions vs K8s versions
- Is this project dead? HOT 3
- Example test from docs broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kubetest.