Skip to content

Commit

Permalink
Fix e2e tests for openapi (take 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Mar 10, 2020
1 parent 2dc57b7 commit 84d51d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 0 additions & 2 deletions e2e/openapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ func TestOpenAPIService(t *testing.T) {
"files/petstore.groovy",
).Execute()).Should(BeNil())

Eventually(integrationPodPhase(ns, "petstore"), testTimeoutLong).
Should(Equal(corev1.PodRunning))
Eventually(knativeService(ns, "petstore"), testTimeoutLong).
Should(Not(BeNil()))

Expand Down
13 changes: 7 additions & 6 deletions e2e/test_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func init() {
client.FastMapperAllowedAPIGroups["project.openshift.io"] = true
client.FastMapperAllowedAPIGroups["eventing.knative.dev"] = true
client.FastMapperAllowedAPIGroups["messaging.knative.dev"] = true
client.FastMapperAllowedAPIGroups["serving.knative.dev"] = true

var err error
testContext = context.TODO()
Expand Down Expand Up @@ -472,7 +473,7 @@ func configmap(ns string, name string) func() *corev1.ConfigMap {

func knativeService(ns string, name string) func() *servingv1.Service {
return func() *servingv1.Service {
cm := servingv1.Service{
answer := servingv1.Service{
TypeMeta: metav1.TypeMeta{
Kind: "Service",
APIVersion: servingv1.SchemeGroupVersion.String(),
Expand All @@ -486,19 +487,19 @@ func knativeService(ns string, name string) func() *servingv1.Service {
Namespace: ns,
Name: name,
}
if err := testClient.Get(testContext, key, &cm); err != nil && k8serrors.IsNotFound(err) {
if err := testClient.Get(testContext, key, &answer); err != nil && k8serrors.IsNotFound(err) {
return nil
} else if err != nil {
log.Errorf(err, "Error while retrieving knative service %s", name)
return nil
}
return &cm
return &answer
}
}

func deployment(ns string, name string) func() *appsv1.Deployment {
return func() *appsv1.Deployment {
cm := appsv1.Deployment{
answer := appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
Kind: "Deployment",
APIVersion: appsv1.SchemeGroupVersion.String(),
Expand All @@ -512,13 +513,13 @@ func deployment(ns string, name string) func() *appsv1.Deployment {
Namespace: ns,
Name: name,
}
if err := testClient.Get(testContext, key, &cm); err != nil && k8serrors.IsNotFound(err) {
if err := testClient.Get(testContext, key, &answer); err != nil && k8serrors.IsNotFound(err) {
return nil
} else if err != nil {
log.Errorf(err, "Error while retrieving deployment %s", name)
return nil
}
return &cm
return &answer
}
}

Expand Down

0 comments on commit 84d51d6

Please sign in to comment.