Commit 74a4a4af authored by Caleb Woodbine's avatar Caleb Woodbine
Browse files

Update: readComponentStatus test to also hit listCoreV1ComponentStatus

parent 9f8fd653
......@@ -184,6 +184,7 @@
path,
description
FROM untested_stable_core_endpoints
WHERE operation_id like '%Component%'
ORDER BY operation_id desc
LIMIT 25
;
......@@ -191,34 +192,11 @@
#+RESULTS: untested_stable_core_endpoints
#+begin_src sql-mode
operation_id | k8s_action | path | description
----------------------------------------------------+------------+---------------------------------------------------------------------+-----------------------------------------------------------
replaceCoreV1PersistentVolumeStatus | put | /api/v1/persistentvolumes/{name}/status | replace status of the specified PersistentVolume
replaceCoreV1PersistentVolume | put | /api/v1/persistentvolumes/{name} | replace the specified PersistentVolume
replaceCoreV1NamespaceStatus | put | /api/v1/namespaces/{name}/status | replace status of the specified Namespace
replaceCoreV1NamespaceFinalize | put | /api/v1/namespaces/{name}/finalize | replace finalize of the specified Namespace
replaceCoreV1NamespacedServiceStatus | put | /api/v1/namespaces/{namespace}/services/{name}/status | replace status of the specified Service
replaceCoreV1NamespacedResourceQuotaStatus | put | /api/v1/namespaces/{namespace}/resourcequotas/{name}/status | replace status of the specified ResourceQuota
replaceCoreV1NamespacedReplicationControllerStatus | put | /api/v1/namespaces/{namespace}/replicationcontrollers/{name}/status | replace status of the specified ReplicationController
replaceCoreV1NamespacedPodTemplate | put | /api/v1/namespaces/{namespace}/podtemplates/{name} | replace the specified PodTemplate
replaceCoreV1NamespacedPodStatus | put | /api/v1/namespaces/{namespace}/pods/{name}/status | replace status of the specified Pod
replaceCoreV1NamespacedPersistentVolumeClaimStatus | put | /api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}/status | replace status of the specified PersistentVolumeClaim
replaceCoreV1NamespacedEvent | put | /api/v1/namespaces/{namespace}/events/{name} | replace the specified Event
replaceCoreV1NamespacedEndpoints | put | /api/v1/namespaces/{namespace}/endpoints/{name} | replace the specified Endpoints
readCoreV1PersistentVolumeStatus | get | /api/v1/persistentvolumes/{name}/status | read status of the specified PersistentVolume
readCoreV1NodeStatus | get | /api/v1/nodes/{name}/status | read status of the specified Node
readCoreV1NamespaceStatus | get | /api/v1/namespaces/{name}/status | read status of the specified Namespace
readCoreV1NamespacedServiceStatus | get | /api/v1/namespaces/{namespace}/services/{name}/status | read status of the specified Service
readCoreV1NamespacedResourceQuotaStatus | get | /api/v1/namespaces/{namespace}/resourcequotas/{name}/status | read status of the specified ResourceQuota
readCoreV1NamespacedReplicationControllerStatus | get | /api/v1/namespaces/{namespace}/replicationcontrollers/{name}/status | read status of the specified ReplicationController
readCoreV1NamespacedPodTemplate | get | /api/v1/namespaces/{namespace}/podtemplates/{name} | read the specified PodTemplate
readCoreV1NamespacedPodStatus | get | /api/v1/namespaces/{namespace}/pods/{name}/status | read status of the specified Pod
readCoreV1NamespacedPersistentVolumeClaimStatus | get | /api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}/status | read status of the specified PersistentVolumeClaim
readCoreV1NamespacedEvent | get | /api/v1/namespaces/{namespace}/events/{name} | read the specified Event
readCoreV1ComponentStatus | get | /api/v1/componentstatuses/{name} | read the specified ComponentStatus
patchCoreV1PersistentVolumeStatus | patch | /api/v1/persistentvolumes/{name}/status | partially update status of the specified PersistentVolume
patchCoreV1PersistentVolume | patch | /api/v1/persistentvolumes/{name} | partially update the specified PersistentVolume
(25 rows)
operation_id | k8s_action | path | description
---------------------------+------------+----------------------------------+--------------------------------------
readCoreV1ComponentStatus | get | /api/v1/componentstatuses/{name} | read the specified ComponentStatus
listCoreV1ComponentStatus | list | /api/v1/componentstatuses | list objects of kind ComponentStatus
(2 rows)
#+end_src
......@@ -260,29 +238,35 @@
fmt.Println(err)
}
// make our work easier to find in the audit_event queries
config.UserAgent = "live-test-pod-count"
config.UserAgent = "live-test-writing"
// creates the clientset
clientset, _ := kubernetes.NewForConfig(config)
// access the API to list pods
cs, _ := clientset.CoreV1().ComponentStatuses().Get("scheduler", v1.GetOptions{})
isHealthy := false
for _, condition := range cs.Conditions {
if condition.Type == "Healthy" && condition.Status == "True" {
isHealthy = true
// get list of components
csList, _ := clientset.CoreV1().ComponentStatuses().List(v1.ListOptions{})
healthyCount := 0
for _, csItem := range csList.Items {
// access the API to list pods
cs, _ := clientset.CoreV1().ComponentStatuses().Get(csItem.ObjectMeta.Name, v1.GetOptions{})
for _, condition := range cs.Conditions {
if condition.Type == "Healthy" && condition.Status == "True" {
healthyCount ++
}
}
}
if isHealthy == false {
fmt.Println("[status] scheduler component is NOT healthy")
if healthyCount != len(csList.Items) {
fmt.Println("[status] components are NOT healthy")
return
}
fmt.Println("[status] scheduler component is healthy")
fmt.Println("[status] components are healthy")
#+end_src
#+RESULTS:
: [status] scheduler component is healthy
: [status] components are healthy
** Example Test in Python
......@@ -354,8 +338,9 @@ s=v1.read_namespaced_pod_status(apod.metadata.name, apod.metadata.namespace, pre
#+begin_src sql-mode
useragent | operation_id | hit_by_ete | hit_by_new_test
---------------------+---------------------------+------------+-----------------
live-test-pod-count | readCoreV1ComponentStatus | 0 | 1
(1 row)
live-test-pod-count | listCoreV1ComponentStatus | 0 | 1
live-test-pod-count | readCoreV1ComponentStatus | 0 | 3
(2 rows)
#+end_src
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment