Skip to content
Snippets Groups Projects
Commit 0cc26e01 authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

switch http test and controller test

parent 81de823a
No related branches found
No related tags found
1 merge request!155Northbound Interface
Pipeline #72816 passed with warnings
This commit is part of merge request !155. Comments created here will be created in the context of that merge request.
......@@ -144,9 +144,9 @@ func update(clientset *kubernetes.Clientset, resource metav1.Common, env string)
opts := metav1.UpdateOptions{}
getOpts := metav1.GetOptions{}
ctx := context.Background()
switch resource.(type) {
switch resource := resource.(type) {
case *corev1.Service:
service := resource.(*corev1.Service)
service := resource
s, err := clientset.CoreV1().Services("cocsn").Get(ctx, env, getOpts)
if err != nil {
return err
......@@ -158,7 +158,7 @@ func update(clientset *kubernetes.Clientset, resource metav1.Common, env string)
}
log.Printf("service %v updated", service.Name)
case *netv1.Ingress:
ingress := resource.(*netv1.Ingress)
ingress := resource
i, err := clientset.NetworkingV1beta1().Ingresses("cocsn").Get(ctx, env, getOpts)
if err != nil {
return err
......@@ -170,7 +170,7 @@ func update(clientset *kubernetes.Clientset, resource metav1.Common, env string)
}
log.Printf("ingress %v updated", ingress.Name)
case *corev1.ConfigMap:
config := resource.(*corev1.ConfigMap)
config := resource
c, err := clientset.CoreV1().ConfigMaps("cocsn").Get(ctx, env+"-config", getOpts)
if err != nil {
return err
......@@ -182,7 +182,7 @@ func update(clientset *kubernetes.Clientset, resource metav1.Common, env string)
}
log.Printf("configMap %v updated", config.Name)
case *appv1.Deployment:
deployment := resource.(*appv1.Deployment)
deployment := resource
d, err := clientset.AppsV1().Deployments("cocsn").Get(ctx, env, getOpts)
if err != nil {
return err
......
......@@ -9,9 +9,6 @@ import (
)
func TestRun(t *testing.T) {
if testing.Short() {
t.Skip("this test is executed separately")
}
type args struct {
request string
}
......@@ -55,14 +52,6 @@ func TestRun(t *testing.T) {
if !reflect.DeepEqual(got.StatusCode, tests[1].want) {
t.Errorf("readyz got: %v, want %v", got.StatusCode, tests[1].want)
}
got, err = http.Get(tests[2].args.request)
if err != nil {
t.Error(err)
return
}
if !reflect.DeepEqual(got.StatusCode, tests[2].want) {
t.Errorf("api init got: %v, want %v", got.StatusCode, tests[2].want)
}
})
cancel()
......
......@@ -6,6 +6,9 @@ import (
)
func Test_httpApi(t *testing.T) {
if testing.Short() {
t.Skip("this test is executed separately")
}
tests := []struct {
name string
request string
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment