-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "oadm pod-network" tests to test/cmd, remove from test/extended #11247
Add "oadm pod-network" tests to test/cmd, remove from test/extended #11247
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem like os::cmd
has a nice way to test that one thing is not another thing, which is unfortunate. We can either improve os::cmd
or make your tests work in a different way, but I am hesitant to test the output of test
. We should also take advantage of the structure and metadata that jUnit suites give us whenever possible.
@@ -4,29 +4,82 @@ trap os::test::junit::reconcile_output EXIT | |||
|
|||
os::test::junit::declare_suite_start "cmd/sdn" | |||
|
|||
# ClusterNetworks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os::test::junit::declare_suite_start "cmd/sdn/cluster-networks"
os::cmd::expect_success 'oc get clusternetworks' | ||
os::cmd::expect_success_and_text 'oc get clusternetwork default -o jsonpath="{.pluginName}"' 'redhat/openshift-ovs-multitenant' | ||
os::cmd::expect_failure_and_text 'oc patch clusternetwork default -p "{\"network\": \"1.0.0.0/8\"}"' 'Invalid value' | ||
os::cmd::expect_failure_and_text 'oc patch clusternetwork default -p "{\"hostsubnetlength\": 22}"' 'Invalid value' | ||
os::cmd::expect_failure_and_text 'oc patch clusternetwork default -p "{\"serviceNetwork\": \"1.0.0.0/8\"}"' 'Invalid value' | ||
|
||
# NetNamespaces |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os::test::junit::declare_suite_start "cmd/sdn/net-namespaces"
os::cmd::expect_success 'oc delete namespace sdn-test' | ||
os::cmd::try_until_failure 'oc get netnamespace sdn-test' | ||
|
||
os::cmd::expect_failure 'oc get netnamespace sdn-test-1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have a habit of checking assumptions like this. Given a good cleanup script for advanced use-cases for the tests, we don't need it. In a normal test-cmd
run, we definitely don't need it.
orig_vnid1="$(oc get netnamespace sdn-test-1 -o jsonpath='{.netid}')" | ||
orig_vnid2="$(oc get netnamespace sdn-test-2 -o jsonpath='{.netid}')" | ||
orig_vnid3="$(oc get netnamespace sdn-test-3 -o jsonpath='{.netid}')" | ||
os::cmd::expect_success "test '$orig_vnid1' != 0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os::cmd::expect_success_and_text "oc get netnamespace sdn-test-1 -o jsonpath='{.netid}'" "[1-9][0-9]*"
if you want to express a test about the structure of the vnid or
os::cmd::expect_success_and_not_text "oc get netnamespace sdn-test-1 -o jsonpath='{.netid}'" "^0$"
if you want this exact test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you've done it this way since you do more tests with the same value below, but I really don't like:
- not wrapping API interactions with
os::cmd
since that's where the logging is really useful - testing the result of a
test
os::cmd::expect_success "test '$orig_vnid1' != 0" | ||
os::cmd::expect_success "test '$orig_vnid2' != 0" | ||
os::cmd::expect_success "test '$orig_vnid3' != 0" | ||
os::cmd::expect_success "test '$orig_vnid1' != '$orig_vnid2'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this would be a little more convoluted than what you've got, but can we:
- make assumptions about the vnids?
- do some sort of test on the aggregate list of vnids from all three namespaces?
os::cmd::expect_success "test '$new_vnid2' = '$orig_vnid1'" | ||
os::cmd::expect_success "test '$new_vnid3' = '$orig_vnid3'" | ||
|
||
os::cmd::expect_success 'oc delete namespace sdn-test-1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be in a cleanup
block at the top along with any other cluster resources you create
|
||
os::cmd::expect_success "oc project '${orig_project}'" | ||
|
||
# HostSubnets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create a jUnit suite like above
# test-cmd environment has no nodes, hence no hostsubnets | ||
os::cmd::expect_success_and_not_text 'oc get hostsubnets' '.' | ||
|
||
# EgressNetworkPolicies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create a jUnit suite like above
@stevekuznetsov hm... I guess the problem is that I'm really mostly testing the behavior of the master, not the behavior of the CLI. I should move that into an integration test and then simplify the cmd test... |
I think that is appropriate. |
@danmcp fyi these tests are taking ~650 of 1800s of the multitenant test run. |
30b33e3
to
3cbc85c
Compare
updated: made suggested general improvements to the cmd test, and moved the actual tests of the master behavior to a new integration test. The cmd test now only checks the output enough to confirm that the correct command executed. |
[test] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bash mostly LGTM
os::cmd::expect_success 'oadm pod-network isolate-projects sdn-test-1' | ||
os::cmd::expect_success_and_not_text 'oc get netnamespace sdn-test-1 -o jsonpath="{.netid}"' '^0$' | ||
|
||
os::cmd::expect_success 'oc delete namespace sdn-test-1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've got these in the cluster cleanup block, I don't think we also need them here.
4e6da66
to
669a2b0
Compare
lgtm |
- add suite start/end markers - add cleanup code - remove code that was testing the master, not the CLI
669a2b0
to
06f4fec
Compare
flake #9845, [test] |
Evaluated for origin test up to 7506909 |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/9838/) |
LGTM [merge] |
re[merge] not sure what happened there... the job just stopped. |
no, it hasn't stopped, it just keeps getting pushed back in the queue by other PRs. The "you are in the build queue at position N" comment has been updated numerous times over the last few days, but it never makes it to "1" |
@stevekuznetsov so, this has been in the merge queue for 2 days now, and it keeps bubbling up and down and apparently getting pre-empted by other PRs. But it will cut 11 minutes off every test run once it lands so it would be cool if there was some way to force to bot to give it higher priority... |
Evaluated for origin merge up to 7506909 |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/9992/) (Base Commit: 3687062) (Image: devenv-rhel7_5168) |
@danwinship we don't allow for line-cutting in the merge queue unless the PR in question has new pushed commits after the last merge tag, as we try to keep everyone on an equal footing. @danmcp could give more insight about why it seemed to be bubbling around. re: "fast merge" -- we specifically did not create a cut-the-line feature, the only tool we have in our shed for this is merge-pretest-success which can only be done globally and is fairly risky. I'm sorry about the frustrating merge process, any suggestions for improvement I will gladly consider. |
@stevekuznetsov Weird. I definitely saw it at position 2 at one point, and then at position 5 a few hours later. And I've seen the same thing before on other PRs. I assumed it was reordering the queue based on priority labels or something. |
No, unclear exactly what's happening, but I believe @danmcp had and still has a core design principle of "no cutting" in the merge queue. |
@stevekuznetsov @danwinship The order of the merge queue is based on commit order. So if someone is ahead of you, it means their commits were made before yours. The reason for picking commit order is it doesn't penalize someone getting their code reviewed that they are losing their potential spot in the merge queue. As far as why there is jumping around, there are a couple of reasons:
|
The connectivity testing in test/extended/networking/pod_network_cli.go is more-or-less redundant with other existing extended networking tests. So just remove it and test just the database-manipulating parts of it in test-cmd instead, to speed up the extended networking tests.
@openshift/networking, @stevekuznetsov PTAL
@danmcp FYI