Merge "Add ONS2018 functest-k8s meeting presentation"
[functest-kubernetes.git] / doc / pres / ons2018 / ons2018-functest-kubernetes.md
1 ### Functional testing for OPNFV Kubernetes (K8s) deployments with Functest
2
3 By: [Konrad Djimeli](mailto:konraddjimeli@gmail.com) (OPNFV Functest Intern)
4
5 Mentor: [Linda Wang](mailto:wangwulin@huawei.com)
6
7
8
9 ### Overview
10
11 Development or integration of tests which can be used to test the functionalities of a Kubernetes deployment, in OPNFV Functest
12
13
14
15 ### Kubernetes
16
17 **Kubernetes (K8s)** is an open source container manager and orchestrator, and can be used as a VIM to orchestrate containerized VNFs.
18
19
20
21 ### K8s provides an End-to-End(e2e) testing framework.
22
23 * Build/deploy/test kubernetes clusters on various providers.
24 * This tests provide a mechanism to test end-to-end behavior of the system.
25
26
27
28 ### K8s End-to-End (e2e)testing
29
30 * The Kubernetes e2e tests are a combination of tests which fall under various categories such as [slow] (more than five minutes), [Serial] (can not run in parallel), etc
31
32
33 ### The k8s e2e tests includes smoke and conformance tests
34
35
36 **Smoke test:** Tests a running Kubernetes cluster. Validates that the cluster was deployed, is accessible, and at least satisfies minimal functional requirements. Emphasis on speed and being non-destructive over thoroughness.
37
38
39 **Conformance tests** : Test expected to pass on any Kubernetes cluster. It is a subset of tests necessary to demonstrate conformance grows with each release. Conformance is thus considered versioned, with backwards compatibility guarantees and are designed to be run with no cloud provider configured.
40
41
42 **The k8s e2e test can be accessed by running the example commands below, within the K8s source code root directory**
43
44 * Build:
45 ```
46 make WHAT=test/e2e/e2e.test
47 ```
48
49 * Run:
50 ```
51 _output/bin/e2e.test --ginkgo.skip="\[Slow\]" --ginkgo.focus=\[Conformance\]"
52 ```
53
54
55
56 ### Integration of the k8s e2e testing framework with OPNFV Functest
57
58 In order to integrate k8s e2e tests into functest, various options were considered such as:
59
60
61 ### Option #1
62 * Creating a docker image with opnfv/functest-core as base image and making use the Functest’s BashFeature class functionality to run the command for the test.
63
64
65 ## OR
66
67
68 ### Option #2
69 * Creating a docker image with opnfv/functest-core as base image and creating a new class which inherits from the functest.core.testcase.TestCase class, which would contain subclasses for various testcases to be run, which are declared in a testcases.yaml file.
70
71
72 **Steps taken to integrate k8s e2e testing into Functest include:**
73
74 * Creating a docker image with opnfv/functest-core as base image (replaced by xtesting)
75 * Building/setting up the k8s e2e testing framework and it requirements in the docker image
76 * Adding the K8sTesting class which inherits from xtesting.core.testcase.TestCase class. It defines the k8s testcases, ensures required env vars are set and logs test output and results.
77 * Creation of a testcases.yaml file, as required by Functest.
78
79 Source code can be found on [gerrit](https://gerrit.opnfv.org/gerrit/gitweb?p=functest-kubernetes.git;a=tree)
80
81
82
83 ### Testing OPNFV k8s deployment with Functest
84
85 To test an example k8s compass deployment, we can do the following
86
87
88 **1.** Get and place your k8s deployment config file in a directory accessible by Functest
89
90
91 **2.** Create an envfile with required environment variables.
92
93 ```
94 DEPLOY_SCENARIO=k8-nosdn-nofeature-ha
95 KUBE_MASTER_IP="192.16.1.210:6443"
96 KUBERNETES_PROVIDER=local
97 KUBE_MASTER_URL=https://192.16.1.210:6443
98 ```
99
100
101 **3.** Run the OPNFV Functest Kubernetes image
102
103 ```
104 sudo docker run --env-file envfile \
105 -v path/to/kube/config:/root/.kube/config \
106 opnfv/functest-kubernetes
107 ```
108
109
110
111 ### Issues Faced
112
113 * Version of k8s to be used for testing (currently v1.9.4)
114 * Virtual deployment using various OPNFV deployers (JOID)
115
116
117
118 ### What still needs to be done
119
120 * Integrating more K8s testcases
121 * Make logging more reliable
122 * Ensure tests work well on different deployments (Compass/Joid/XCI)
123 * Add exhaustive documentation of tests and how they work
124 * Complete/update unit testing
125 * Optimize container
126 * Add documentation
127
128
129
130 *We intend to ensure Functest K8s testing, properly provides functionality testing for OPNFV Kubernetes deployments and to also make it a very reliable testing framework.*