Skip to content

Commit

Permalink
OCP-26014: fix syntax and fix clean-up steps (openshift#2681)
Browse files Browse the repository at this point in the history
There seems to be a syntax issue and a test logic issue.

I don't know why/how sometimes the old step "OVN is functional on the cluster"
works, but the proper syntax seems to be to require a "Given" before the step.

When the step fails without the "Given", it fails in steps_parser.

```
<NoMethodError: undefined method `each' for nil:NilClass>
/home/jenkins/.gem/bundler/ruby/2.7.0/gems/cucumber-5.3.0/lib/cucumber/runtime/support_code.rb:21:in `steps'
/home/jenkins/.gem/bundler/ruby/2.7.0/gems/cucumber-5.3.0/lib/cucumber/gherkin/steps_parser.rb:23:in `parse'
/home/jenkins/.gem/bundler/ruby/2.7.0/gems/cucumber-5.3.0/lib/cucumber/runtime/support_code.rb:63:in `invoke_dynamic_steps'
/opt/rh/rh-ruby27/root/usr/share/ruby/forwardable.rb:235:in `invoke_dynamic_steps'
/home/jenkins/.gem/bundler/ruby/2.7.0/gems/cucumber-5.3.0/lib/cucumber/glue/proto_world.rb:168:in `block (2 levels) in for'
/home/jenkins/.gem/bundler/ruby/2.7.0/gems/cucumber-5.3.0/lib/cucumber/glue/proto_world.rb:41:in `steps'
features/step_definitions/meta_steps.rb:48:in `block (2 levels) in '
lib/base_helper.rb:160:in `wait_for'
features/step_definitions/meta_steps.rb:43:in `/^I wait(?: up to ([0-9]+|<%=.+?%>) seconds)? for the steps to pass:$/'
features/networking/pod.feature:496:in `I wait up to 60 seconds for the steps to pass:'
```

But the real issue seems to be the test logic.  We don't delete the pod to force CNO
to repair the cluster until after the scenario so the
"OVN is functional on the cluster" step won't pass.

Instead move the delete pod and OVN functional check into the clean-up
steps.

CNO recovers the pods quickly in less than 60 seconds
  • Loading branch information
rbbratta authored Feb 15, 2022
1 parent 58cbd66 commit 15744fc
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions features/networking/pod.feature
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,15 @@ Feature: Pod related networking scenarios
And I use the "openshift-ovn-kubernetes" project
And a pod is present with labels:
| app=ovnkube-node |
# Making sure the cluster is in good state before exiting from this scenario
# Deleting ovnkube-pod will force CNO to rewrite the conf file and bring cluster back to normal
# Wait 60 seconds to make sure ovnkube-pods recover
And I register clean-up steps:
"""
admin ensures "<%= pod.name %>" pod is deleted from the "openshift-ovn-kubernetes" project
I wait up to 60 seconds for the steps to pass:
| Given OVN is functional on the cluster |
"""
#Removing CNI config file from container to check readiness probe functionality
When I run the :exec client command with:
| pod | <%= pod.name %> |
Expand All @@ -480,23 +489,17 @@ Feature: Pod related networking scenarios
| exec_command | rm |
| exec_command_arg | /etc/cni/net.d/10-ovn-kubernetes.conf |
Then the step should succeed
#Deleting ovnkube-pod will force CNO to rewrite the conf file and bring cluster back to normal after scenario
And admin ensures "<%= pod.name %>" pod is deleted from the "openshift-ovn-kubernetes" project after scenario
#Now make sure readiness probe checking above file will cause one of the two ovnkube-node containers to go down and container ready status change to false
# Now make sure readiness probe checking above file will cause one of the two ovnkube-node containers to go down and container ready status change to false
Given I wait up to 30 seconds for the steps to pass:
"""
When I run the :get admin command with:
| resource | pod |
| resource_name | <%= pod.name %> |
| o | jsonpath='{.status.containerStatuses[?(@.name=="ovnkube-node")].ready}' |
| resource | pod |
| resource_name | <%= pod.name %> |
| o | jsonpath={.status.containerStatuses[?(@.name=="ovnkube-node")].ready} |
Then the step should succeed
And the output should contain "false"
"""
#Making sure the cluster is in good state before exiting from this scenario
And I wait up to 60 seconds for the steps to pass:
"""
OVN is functional on the cluster
"""

# @author anusaxen@redhat.com
# @case_id OCP-33413
@admin
Expand Down

0 comments on commit 15744fc

Please sign in to comment.