Skip to content
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

e2e test cases for basic SCTP testing #88196

Merged
merged 1 commit into from
May 30, 2020
Merged

Conversation

janosi
Copy link
Contributor

@janosi janosi commented Feb 15, 2020

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:

/kind api-change
/kind bug
/kind cleanup
/kind deprecation
/kind design
/kind documentation
/kind failing-test

/kind feature

/kind flake

What this PR does / why we need it:
This PR is to implement the basic e2e test cases for the SCTP support feature as defined at https://github.com/kubernetes/enhancements/blob/master/keps/sig-network/0015-20180614-SCTP-support.md#basic-tests

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 15, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @janosi. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test sig/network Categorizes an issue or PR as relevant to SIG Network. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 15, 2020
@danwinship
Copy link
Contributor

/assign

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 1, 2020
@janosi janosi changed the title WIP - e2e test cases for basic SCTP testing e2e test cases for basic SCTP testing Mar 1, 2020
@k8s-ci-robot k8s-ci-robot added area/dependency Issues or PRs related to dependency changes and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Mar 1, 2020
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 1, 2020
if err != nil {
framework.Logf("sctp module is not loaded or error occured while executing command %s on node: %v", cmd, err)
return false
} else {
framework.Logf("the sctp module is loaded on node: %v", node.Name)
return true
for _, line := range strings.Split(result, "\n") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do this block needs to be inside the else?
it seems that if err != nil it will return so no need to use it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

framework.Logf("the sctp module is loaded on node: %v", node.Name)
return true
for _, line := range strings.Split(result, "\n") {
if !strings.Contains(line, "xt_sctp") && !!strings.Contains(line, "nf_conntrack_proto_sctp") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry if this is a dumb question but if I do execute in my host I have

linux-6my5:~ # lsmod | grep sctp
sctp_diag              16384  0
sctp                  352256  39 sctp_diag
inet_diag              20480  4 raw_diag,tcp_diag,sctp_diag,udp_diag
libcrc32c              16384  5 ip_vs,nf_conntrack,xfs,nf_nat,sctp

is this if looking for a line that does not contain xt_sctp and nf_conntrack_proto_sctp?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that if tries to filter out those modules that are not harmful from userspace SCTP stack perspective. But the best would be to check if the sctp module is loaded or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coded a more sophisticated one with regex.

Copy link
Contributor

@danwinship danwinship left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay in getting back to this. This looks ready to go; I just have nitpicks.

@@ -1482,9 +1484,48 @@ var _ = SIGDescribe("NetworkPolicy [LinuxOnly]", func() {
})
cleanupServerPodAndService(f, podA, serviceA)
})
ginkgo.It("should allow acces only for SCTP on port 80 [Feature:NetworkPolicy] [Feature:SCTP]", func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo "acces"
but this test name doesn't describe what the test is doing well.
"It should not allow access by TCP when a policy specifies only SCTP" or something like that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

cs = f.ClientSet
})

ginkgo.It("should serve a basic SCTP service with pod and endpoints", func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"serve" makes it sound like this is testing that network traffic actually works, which it is not
"should allow creating a basic SCTP service with pod and endpoints"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

framework.ExpectNoError(err, "failed to delete service: %s in namespace: %s", serviceName, ns)
}()

err = framework.WaitForService(f.ClientSet, ns, serviceName, true, 5*time.Second, 45*time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meh. test cases shouldn't have hard-coded time values, they should use constants defined in e2e/framework... But the tests are kind of a mess and there are no obvious constants you could use here... I guess replace 45*time.Second with e2eservice.TestTimeout.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

framework.ExpectNoError(err, "failed to delete service: %s in namespace: %s", serviceName, ns)
}()

err = framework.WaitForService(f.ClientSet, ns, serviceName, true, 5*time.Second, 45*time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e2eservice.TestTimeout again

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

framework.Failf("The state of the sctp module has changed due to the test case")
}
})
ginkgo.It("should create a NodePort Service with SCTP ports", func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... I'm not sure this is really testing much more than the non-NodePort test. May not be worth having both.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Deleted.


// VerifySCTPModuleLoadedOnNodes checks whether any node on the list has the
// sctp.ko module loaded
func VerifySCTPModuleLoadedOnNodes(f *framework.Framework, nodes *v1.NodeList) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Verify" makes it sound like the goal of the function is to ensure that SCTP is loaded, when in fact we want the opposite. Maybe rename to CheckSCTPModuleLoadedOnNodes? Or else VerifySCTPModuleNotLoadedOnNodes but then you'd have to flip the sense of the return value too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -76,3 +79,27 @@ func newAgnhostPod(name string, args ...string) *v1.Pod {
},
}
}

// VerifySCTPModuleLoadedOnNodes checks whether any node on the list has the
// sctp.ko module loaded
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably also a good place to document why we are doing this:

// For security reasons, and also to allow clusters to use userspace SCTP implementations,
// we require that just creating an SCTP Pod/Service/NetworkPolicy must not do anything
// that would cause the sctp kernel module to be loaded.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@janosi janosi force-pushed the sctp-e2e branch 2 times, most recently from 12f0791 to 377260f Compare April 22, 2020 10:25
@janosi
Copy link
Contributor Author

janosi commented Apr 22, 2020

/retest

@danwinship
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 28, 2020
@danwinship
Copy link
Contributor

oops, and
/approved

@aojea
Copy link
Member

aojea commented May 28, 2020

/retest
something odd is happening with kinds jobs and are timing out

@janosi
Copy link
Contributor Author

janosi commented May 29, 2020

/retest

1 similar comment
@janosi
Copy link
Contributor Author

janosi commented May 29, 2020

/retest

@danwinship
Copy link
Contributor

sigh
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danwinship, janosi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 29, 2020
@danwinship
Copy link
Contributor

/hold
@janosi I think that you should clean the git history and squash all commits before merge.

that happened a while back
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 29, 2020
@janosi
Copy link
Contributor Author

janosi commented May 29, 2020

/retest

3 similar comments
@janosi
Copy link
Contributor Author

janosi commented May 29, 2020

/retest

@janosi
Copy link
Contributor Author

janosi commented May 29, 2020

/retest

@janosi
Copy link
Contributor Author

janosi commented May 29, 2020

/retest

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

4 similar comments
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit a017253 into kubernetes:master May 30, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.19 milestone May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/dependency Issues or PRs related to dependency changes area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. sig/network Categorizes an issue or PR as relevant to SIG Network. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants