summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/mock_files
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2018-09-18 17:19:00 -0700
committerVictor Morales <victor.morales@intel.com>2018-09-18 17:19:00 -0700
commit05274b1b149139d91445ca10a73defe41f14824a (patch)
tree2ad5e9169a521d29d0c909a271f1ff23b35d2dac /src/k8splugin/mock_files
parentb368dfe25337494060eb8cd85a5becaf7a465643 (diff)
Add UTs to plugins
Deployment, service and namespace are plugins which offers CRUD operations to manage their resources. They haven't implemented Unit Tests which makes fragile to change/refactor the source code. This change adds their corresponding Unit Tests and defines a standard interface. Change-Id: I1e1eb40f1a18ba33c74069a117462c8df17767ac Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-301
Diffstat (limited to 'src/k8splugin/mock_files')
-rw-r--r--src/k8splugin/mock_files/mock_plugins/mockplugin.go20
-rw-r--r--src/k8splugin/mock_files/mock_yamls/deployment.yaml2
-rw-r--r--src/k8splugin/mock_files/mock_yamls/service.yaml2
3 files changed, 12 insertions, 12 deletions
diff --git a/src/k8splugin/mock_files/mock_plugins/mockplugin.go b/src/k8splugin/mock_files/mock_plugins/mockplugin.go
index 9ceec342..c31e4fe2 100644
--- a/src/k8splugin/mock_files/mock_plugins/mockplugin.go
+++ b/src/k8splugin/mock_files/mock_plugins/mockplugin.go
@@ -21,23 +21,23 @@ import (
func main() {}
-// CreateResource object in a specific Kubernetes resource
-func CreateResource(kubedata *krd.GenericKubeResourceData, kubeclient *kubernetes.Clientset) (string, error) {
+// Create object in a specific Kubernetes resource
+func Create(data *krd.ResourceData, client kubernetes.Interface) (string, error) {
return "externalUUID", nil
}
-// ListResources of existing resources
-func ListResources(limit int64, namespace string, kubeclient *kubernetes.Clientset) (*[]string, error) {
+// List of existing resources
+func List(namespace string, client kubernetes.Interface) ([]string, error) {
returnVal := []string{"cloud1-default-uuid1", "cloud1-default-uuid2"}
- return &returnVal, nil
+ return returnVal, nil
}
-// DeleteResource existing resources
-func DeleteResource(name string, namespace string, kubeclient *kubernetes.Clientset) error {
+// Delete existing resources
+func Delete(name string, namespace string, client kubernetes.Interface) error {
return nil
}
-// GetResource existing resource host
-func GetResource(namespace string, client *kubernetes.Clientset) (bool, error) {
- return true, nil
+// Get existing resource host
+func Get(name string, namespace string, client kubernetes.Interface) (string, error) {
+ return name, nil
}
diff --git a/src/k8splugin/mock_files/mock_yamls/deployment.yaml b/src/k8splugin/mock_files/mock_yamls/deployment.yaml
index eff2fc5a..49a30efc 100644
--- a/src/k8splugin/mock_files/mock_yamls/deployment.yaml
+++ b/src/k8splugin/mock_files/mock_yamls/deployment.yaml
@@ -12,7 +12,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
- name: sise-deploy
+ name: mock-deployment
spec:
template:
metadata:
diff --git a/src/k8splugin/mock_files/mock_yamls/service.yaml b/src/k8splugin/mock_files/mock_yamls/service.yaml
index 297ab1b7..71938949 100644
--- a/src/k8splugin/mock_files/mock_yamls/service.yaml
+++ b/src/k8splugin/mock_files/mock_yamls/service.yaml
@@ -12,7 +12,7 @@
apiVersion: v1
kind: Service
metadata:
- name: sise-svc
+ name: mock-service
spec:
ports:
- port: 80