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

Write ServiceProxyOptions test+promote - +13 endpoint coverage #92951

Closed
1 of 6 tasks
riaankleinhans opened this issue Jul 10, 2020 · 2 comments
Closed
1 of 6 tasks

Write ServiceProxyOptions test+promote - +13 endpoint coverage #92951

riaankleinhans opened this issue Jul 10, 2020 · 2 comments
Labels
area/conformance Issues or PRs related to kubernetes conformance tests lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. sig/testing Categorizes an issue or PR as relevant to SIG Testing.

Comments

@riaankleinhans
Copy link
Contributor

Progress [1/6]

Identifying an untested feature Using APISnoop

According to this APIsnoop query, there are still some remaining ServiceProxyOptions endpoints which are untested.

SELECT
  operation_id,
  -- k8s_action,
  -- path,
  description,
  kind
  FROM untested_stable_core_endpoints
  -- FROM untested_stable_endpoints
  where path not like '%volume%'
  and kind like 'ServiceProxyOptions'
  -- and operation_id ilike '%%'
 ORDER BY kind,operation_id desc
 LIMIT 25
       ;
                    operation_id                    |                 description                  |        kind         
----------------------------------------------------+----------------------------------------------+---------------------
 connectCoreV1PutNamespacedServiceProxyWithPath     | connect PUT requests to proxy of Service     | ServiceProxyOptions
 connectCoreV1PutNamespacedServiceProxy             | connect PUT requests to proxy of Service     | ServiceProxyOptions
 connectCoreV1PostNamespacedServiceProxyWithPath    | connect POST requests to proxy of Service    | ServiceProxyOptions
 connectCoreV1PostNamespacedServiceProxy            | connect POST requests to proxy of Service    | ServiceProxyOptions
 connectCoreV1PatchNamespacedServiceProxyWithPath   | connect PATCH requests to proxy of Service   | ServiceProxyOptions
 connectCoreV1PatchNamespacedServiceProxy           | connect PATCH requests to proxy of Service   | ServiceProxyOptions
 connectCoreV1OptionsNamespacedServiceProxyWithPath | connect OPTIONS requests to proxy of Service | ServiceProxyOptions
 connectCoreV1OptionsNamespacedServiceProxy         | connect OPTIONS requests to proxy of Service | ServiceProxyOptions
 connectCoreV1HeadNamespacedServiceProxyWithPath    | connect HEAD requests to proxy of Service    | ServiceProxyOptions
 connectCoreV1HeadNamespacedServiceProxy            | connect HEAD requests to proxy of Service    | ServiceProxyOptions
 connectCoreV1GetNamespacedServiceProxy             | connect GET requests to proxy of Service     | ServiceProxyOptions
 connectCoreV1DeleteNamespacedServiceProxyWithPath  | connect DELETE requests to proxy of Service  | ServiceProxyOptions
 connectCoreV1DeleteNamespacedServiceProxy          | connect DELETE requests to proxy of Service  | ServiceProxyOptions
(13 rows)

Looking for feedback on what direction should be taken with these endpoints and the best method for testing them.

API Reference and feature documentation

The mock test

Test outline

Test the functionality in Go

package main

import (
  "fmt"
  "context"
  "flag"
  "os"
  v1 "k8s.io/api/core/v1"
  metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  "k8s.io/client-go/kubernetes"
  "k8s.io/client-go/tools/clientcmd"
)

func main() {
  // uses the current context in kubeconfig
  kubeconfig := flag.String("kubeconfig", fmt.Sprintf("%v/%v/%v", os.Getenv("HOME"), ".kube", "config"), "(optional) absolute path to the kubeconfig file")
  flag.Parse()
  config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)
  if err != nil {
      fmt.Println(err, "Could not build config from flags")
      return
  }
  // make our work easier to find in the audit_event queries
  config.UserAgent = "live-test-writing"
  // creates the clientset
  ClientSet, _ := kubernetes.NewForConfig(config)
  // DynamicClientSet, _ := dynamic.NewForConfig(config)
  // podResource := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}

  // TEST BEGINS HERE


  // TEST ENDS HERE

  fmt.Println("[status] complete")

}

Verifying increase in coverage with APISnoop

Discover useragents:

select distinct useragent from audit_event where bucket='apisnoop' and useragent not like 'kube%' and useragent not like 'coredns%' and useragent not like 'kindnetd%' and useragent like 'live%';

List endpoints hit by the test:

select * from endpoints_hit_by_new_test where useragent like 'live%';

Display endpoint coverage change:

select * from projected_change_in_coverage;
   category    | total_endpoints | old_coverage | new_coverage | change_in_number
---------------+-----------------+--------------+--------------+------------------
 test_coverage |             438 |          183 |          183 |                0
(1 row)

Final notes

If a test with these calls gets merged, test coverage will go up by N points

This test is also created with the goal of conformance promotion.


/sig testing

/sig architecture

/area conformance

@k8s-ci-robot k8s-ci-robot added sig/testing Categorizes an issue or PR as relevant to SIG Testing. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. area/conformance Issues or PRs related to kubernetes conformance tests labels Jul 10, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 8, 2020
@riaankleinhans
Copy link
Contributor Author

This exploration have been moved forward by #92949 & #95503 and can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/conformance Issues or PRs related to kubernetes conformance tests lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. sig/testing Categorizes an issue or PR as relevant to SIG Testing.
Projects
None yet
Development

No branches or pull requests

3 participants