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

Add dualstack test to validate k3s issue 10053 #106

Merged
merged 7 commits into from
Jul 2, 2024

Conversation

rancher-max
Copy link
Contributor

Proposed Changes

Added dualstack test to validate issue

Types of Changes

issue validation

Testing

Checklist:

  1. If your PR changes anything on or related to Jenkins, run it pointing to your branch to make sure it's okay.

  2. Verify code lint; we should not have errors.

  3. Update the documentation if needed.
    N/A

  4. Update makefile and docker run if adding new tests.
    N/A

  5. Run your tests at least 4 times with all configurations needed and possible.

  6. If needed test with different os types.

Linked Issues

k3s-io/k3s#10053

Further Comments

@rbrtbnfgl @manuelbuil -- adding you both as reviewers to generally make sure the steps are as expected in pkg/testcase/dualstack.go

I can confirm when running via a recent commitid where it is fixed this works as expected:

Working log snippet

Applying  k3s_issue_10053_ns.yaml

Applying  k3s_issue_10053_pod1.yaml

Applying  k3s_issue_10053_pod2.yaml

Command:
kubectl exec -n test-k3s-issue-10053 pod/client --kubeconfig=/tmp/maxk3slocal_kubeconfig -- wget -O - http://10.42.1.8
---------------------
Assertion:
Hostname: server
----------------------
Matched with result:
Hostname: server
IP: 127.0.0.1
IP: ::1
IP: 10.42.1.8
IP: 2001:cafe:42:1::8
IP: fe80::305c:28ff:fe7a:2de2
RemoteAddr: 10.42.1.9:35452
GET / HTTP/1.1
Host: 10.42.1.8
User-Agent: Wget
Accept: */*
Connection: close

Applying  k3s_issue_10053_netpol.yaml

Command:
kubectl exec -n test-k3s-issue-10053 pod/client --kubeconfig=/tmp/maxk3slocal_kubeconfig -- wget -O - http://10.42.1.8
---------------------
Assertion:
Hostname: server
----------------------
Matched with result:
Hostname: server
IP: 127.0.0.1
IP: ::1
IP: 10.42.1.8
IP: 2001:cafe:42:1::8
IP: fe80::305c:28ff:fe7a:2de2
RemoteAddr: 10.42.1.9:59292
GET / HTTP/1.1
Host: 10.42.1.8
User-Agent: Wget
Accept: */*
Connection: close

Removing k3s_issue_10053_pod1.yaml

Applying  k3s_issue_10053_pod1.yaml

Command:
kubectl exec -n test-k3s-issue-10053 pod/client --kubeconfig=/tmp/maxk3slocal_kubeconfig -- wget -O - http://10.42.1.10
---------------------
Assertion:
Hostname: server
----------------------
Matched with result:
Hostname: server
IP: 127.0.0.1
IP: ::1
IP: 10.42.1.10
IP: 2001:cafe:42:1::a
IP: fe80::c8dd:d4ff:fec9:fa72
RemoteAddr: 10.42.1.9:60628
GET / HTTP/1.1
Host: 10.42.1.10
User-Agent: Wget
Accept: */*
Connection: close

Removing k3s_issue_10053_ns.yaml

PASSED! Test: [k3s/10053] Validates Ingress after Pod Restart when Network Policies are present
•

Ran 8 of 8 Specs in 416.153 seconds
SUCCESS! -- 8 Passed | 0 Failed | 0 Pending | 0 Skipped
--- PASS: TestDualStackSuite (416.15s)
PASS
ok  	github.com/rancher/distros-test-framework/entrypoint/dualstack	417.009s

And when using the previous released version (v1.30.1+k3s1) this fails as expected:

Failing log snippet

Applying  k3s_issue_10053_ns.yaml

Applying  k3s_issue_10053_pod1.yaml

Applying  k3s_issue_10053_pod2.yaml

Command:
kubectl exec -n test-k3s-issue-10053 pod/client --kubeconfig=/tmp/maxk3slocal_kubeconfig -- wget -O - http://10.42.1.8
---------------------
Assertion:
Hostname: server
----------------------
Matched with result:
Hostname: server
IP: 127.0.0.1
IP: ::1
IP: 10.42.1.8
IP: 2001:cafe:42:1::8
IP: fe80::e8a6:8bff:fe3a:fcc0
RemoteAddr: 10.42.1.9:33756
GET / HTTP/1.1
Host: 10.42.1.8
User-Agent: Wget
Accept: */*
Connection: close

Applying  k3s_issue_10053_netpol.yaml

Command:
kubectl exec -n test-k3s-issue-10053 pod/client --kubeconfig=/tmp/maxk3slocal_kubeconfig -- wget -O - http://10.42.1.8
---------------------
Assertion:
Hostname: server
----------------------
Matched with result:
Hostname: server
IP: 127.0.0.1
IP: ::1
IP: 10.42.1.8
IP: 2001:cafe:42:1::8
IP: fe80::e8a6:8bff:fe3a:fcc0
RemoteAddr: 10.42.1.9:33764
GET / HTTP/1.1
Host: 10.42.1.8
User-Agent: Wget
Accept: */*
Connection: close

Removing k3s_issue_10053_pod1.yaml

Applying  k3s_issue_10053_pod1.yaml
WARN[2024-05-29T22:23:17Z] error from exec runAssertion: Connecting to 10.42.1.10 (10.42.1.10:80)
wget: can't connect to remote host (10.42.1.10): Connection refused
command terminated with exit code 1

 with res: %!v(MISSING)
Retrying... 
WARN[2024-05-29T22:23:20Z] error from exec runAssertion: Connecting to 10.42.1.10 (10.42.1.10:80)
wget: can't connect to remote host (10.42.1.10): Connection refused
command terminated with exit code 1

 with res: %!v(MISSING)
Retrying... 
WARN[2024-05-29T22:23:23Z] error from exec runAssertion: Connecting to 10.42.1.10 (10.42.1.10:80)
wget: can't connect to remote host (10.42.1.10): Connection refused
command terminated with exit code 1

...

ERRO[2024-05-29T22:25:13Z] timeout reached for command:
kubectl exec -n test-k3s-issue-10053 pod/client --kubeconfig=/tmp/maxk3slocal_kubeconfig -- wget -O - http://10.42.1.10
Trying to assert with:
Connecting to 10.42.1.10 (10.42.1.10:80)
wget: can't connect to remote host (10.42.1.10): Connection refused
command terminated with exit code 1

Expected value: Hostname: server

Last call: github.com/rancher/distros-test-framework/pkg/assert.runAssertion in file:/go/src/github.com/rancher/distros-test-framework/pkg/assert/validate.go:70 
ERRO[2024-05-29T22:25:13Z] timeout reached for command:
kubectl exec -n test-k3s-issue-10053 pod/client --kubeconfig=/tmp/maxk3slocal_kubeconfig -- wget -O - http://10.42.1.10
Trying to assert with:
Connecting to 10.42.1.10 (10.42.1.10:80)
wget: can't connect to remote host (10.42.1.10): Connection refused
command terminated with exit code 1

Expected value: Hostname: server

...

FAILED! Test: [k3s/10053] Validates Ingress after Pod Restart when Network Policies are present

------------------------------
• [PANICKED] [147.612 seconds]
Test: [It] [k3s/10053] Validates Ingress after Pod Restart when Network Policies are present
/go/src/github.com/rancher/distros-test-framework/entrypoint/dualstack/dualstack_test.go:49

  [PANICKED] Test Panicked
  In [It] at: /usr/local/go/src/runtime/iface.go:262 @ 05/29/24 22:25:13.285

  interface conversion: interface {} is *errors.errorString, not string

  Full Stack Trace
    github.com/onsi/gomega/internal.(*Assertion).buildDescription(0x40?, {0xc00071e8d0?, 0xc00071e630?, 0xc0001c9d40?})
    	/go/pkg/mod/github.com/onsi/gomega@v1.31.1/internal/assertion.go:86 +0xd7
    github.com/onsi/gomega/internal.(*Assertion).match(0xc00015a5c0, {0x16d66b0, 0x1fcb780}, 0x0, {0xc00071e8d0, 0x1, 0x1})
    	/go/pkg/mod/github.com/onsi/gomega@v1.31.1/internal/assertion.go:105 +0x17c
    github.com/onsi/gomega/internal.(*Assertion).NotTo(0xc00015a5c0, {0x16d66b0, 0x1fcb780}, {0xc00071e8d0, 0x1, 0x1})
    	/go/pkg/mod/github.com/onsi/gomega@v1.31.1/internal/assertion.go:74 +0xad
    github.com/rancher/distros-test-framework/pkg/assert.ValidateIntraNSPodConnectivity({0x1170eb9?, 0x16d6aa0?}, {0x115f130, 0x6}, {0xc000834276, 0xa}, {0x116b450, 0x10})
    	/go/src/github.com/rancher/distros-test-framework/pkg/assert/pod.go:143 +0x206
    github.com/rancher/distros-test-framework/pkg/testcase.TestIngressWithPodRestartAndNetPol(0x1)
    	/go/src/github.com/rancher/distros-test-framework/pkg/testcase/dualstack.go:194 +0x5a5
    github.com/rancher/distros-test-framework/entrypoint/dualstack.init.func2.8()
    	/go/src/github.com/rancher/distros-test-framework/entrypoint/dualstack/dualstack_test.go:50 +0x18
------------------------------

Summarizing 1 Failure:
  [PANICKED!] Test: [It] [k3s/10053] Validates Ingress after Pod Restart when Network Policies are present
  /usr/local/go/src/runtime/iface.go:262

Ran 8 of 8 Specs in 528.465 seconds
FAIL! -- 7 Passed | 1 Failed | 0 Pending | 0 Skipped
--- FAIL: TestDualStackSuite (528.47s)
FAIL
FAIL	github.com/rancher/distros-test-framework/entrypoint/dualstack	528.898s
FAIL

@manuelbuil
Copy link

hey Max, when are these tests being run? I know about the e2e tests being run nightly but I was not aware of these

@rancher-max
Copy link
Contributor Author

These are the tests that QA runs in Jenkins and locally during patch testing/issue validation, using real environments (instances in AWS) to match what users are likely doing

manuelbuil
manuelbuil previously approved these changes May 31, 2024
pkg/testcase/dualstack.go Outdated Show resolved Hide resolved
Signed-off-by: rancher-max <max.ross@suse.com>
Signed-off-by: rancher-max <max.ross@suse.com>
Signed-off-by: rancher-max <max.ross@suse.com>
Signed-off-by: rancher-max <max.ross@suse.com>
Signed-off-by: rancher-max <max.ross@suse.com>
Signed-off-by: rancher-max <max.ross@suse.com>
func TestIngressWithPodRestartAndNetPol(cluster *factory.Cluster, deleteWorkload bool) {
// Deploy server and client pods
err := shared.ManageWorkload("apply", "k3s_issue_10053_ns.yaml",
"k3s_issue_10053_pod1.yaml", "k3s_issue_10053_pod2.yaml")
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this reference to issue

@rancher-max rancher-max merged commit 64a8f05 into rancher:main Jul 2, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants