Commit Graph

76 Commits

Author SHA1 Message Date
Patrick Ohly
136f89dfc5 e2e: use error wrapping with %w
The recently introduced failure handling in ExpectNoError depends on error
wrapping: if an error prefix gets added with `fmt.Errorf("foo: %v", err)`, then
ExpectNoError cannot detect that the root cause is an assertion failure and
then will add another useless "unexpected error" prefix and will not dump the
additional failure information (currently the backtrace inside the E2E
framework).

Instead of manually deciding on a case-by-case basis where %w is needed, all
error wrapping was updated automatically with

    sed -i "s/fmt.Errorf\(.*\): '*\(%s\|%v\)'*\",\(.* err)\)/fmt.Errorf\1: %w\",\3/" $(git grep -l 'fmt.Errorf' test/e2e*)

This may be unnecessary in some cases, but it's not wrong.
2023-02-06 15:39:13 +01:00
Patrick Ohly
9df3e2a47a e2e: replace WaitForPodToDisappear with WaitForPodNotFoundInNamespace
WaitForPodToDisappear was always called such that it listed all pods, which
made it less efficient than trying to get just the one pod it was checking for.

Being able to customize the poll interval in practice wasn't useful, therefore
it can be replaced with WaitForPodNotFoundInNamespace.
2023-02-06 15:39:12 +01:00
Antonio Ojea
7f5ae1c0c1
Revert "e2e: wait for pods with gomega" 2023-02-06 12:08:22 +01:00
Patrick Ohly
222f655062 e2e: use error wrapping with %w
The recently introduced failure handling in ExpectNoError depends on error
wrapping: if an error prefix gets added with `fmt.Errorf("foo: %v", err)`, then
ExpectNoError cannot detect that the root cause is an assertion failure and
then will add another useless "unexpected error" prefix and will not dump the
additional failure information (currently the backtrace inside the E2E
framework).

Instead of manually deciding on a case-by-case basis where %w is needed, all
error wrapping was updated automatically with

    sed -i "s/fmt.Errorf\(.*\): '*\(%s\|%v\)'*\",\(.* err)\)/fmt.Errorf\1: %w\",\3/" $(git grep -l 'fmt.Errorf' test/e2e*)

This may be unnecessary in some cases, but it's not wrong.
2023-01-31 13:01:39 +01:00
Patrick Ohly
6eea1b2efa e2e: replace WaitForPodToDisappear with WaitForPodNotFoundInNamespace
WaitForPodToDisappear was always called such that it listed all pods, which
made it less efficient than trying to get just the one pod it was checking for.

Being able to customize the poll interval in practice wasn't useful, therefore
it can be replaced with WaitForPodNotFoundInNamespace.
2023-01-31 13:01:39 +01:00
Kubernetes Prow Robot
55181b72a2
Merge pull request #113799 from r4f4/nettest-priv-ip
tests: network: Prefer internal IPs first
2022-12-20 17:37:24 -08:00
Patrick Ohly
2f6c4f5eab e2e: use Ginkgo context
All code must use the context from Ginkgo when doing API calls or polling for a
change, otherwise the code would not return immediately when the test gets
aborted.
2022-12-16 20:14:04 +01:00
Ang Gao
3540f948e9 Update method name to make it more explicit 2022-12-12 21:50:07 +00:00
Rafael Fonseca
f98aa32c5a tests: network: Prefer internal IPs first
Many clusters block direct requests from internal resources to the nodes
external IPs as best practice. All accesses from internal resources that
want to access resources running on nodes go through load balancers,
nodes being on private or public subnets. Let's prefer internal IPs
first, so the tests can work even when there are security group rules
present blocking requests to the external IPs.

We should not require ExternalIP for Conformance, but should keep
testing ExternalIPs in sig network.

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
2022-11-14 17:56:46 +01:00
Patrick Ohly
5614a9d064 e2e framework: eliminate interim sub packages
The "todo" packages were necessary while moving code around to avoid hitting
cyclic dependencies. Now that any sub package can depend on the framework, they
are no longer needed and the code can be moved into the normal sub packages.
2022-10-06 08:16:47 +02:00
Patrick Ohly
a46fea53e6 e2e framework: move pod exec and create into sub package 2022-10-06 08:16:47 +02:00
Patrick Ohly
b8d28cb6c3 e2e framework: move node helper code into sub package
This reduces the size of the test/e2e/framework itself. Because it does not
check nodes anymore by default, E2E test suites must set their own check
function or set the original one by importing
"k8s.io/kubernetes/test/e2e/framework/todo/node/init".
2022-10-06 08:16:47 +02:00
Patrick Ohly
2c8ef492ae e2e framework: move kubectl and pod helper code 2022-10-06 08:16:47 +02:00
Humble Chirammal
9e9fc2be88 various corrections in test/e2e package
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2022-09-16 18:59:30 +05:30
Hyeongju Johannes Lee
0bd220ca39 Fix typo of e2e utils under network framework
Fix typo "contaienr" to "container"
2022-08-22 14:15:09 +03:00
Davanum Srinivas
a9593d634c
Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
Dave Chen
857458cfa5 update ginkgo from v1 to v2 and gomega to 1.19.0
- update all the import statements
- run hack/pin-dependency.sh to change pinned dependency versions
- run hack/update-vendor.sh to update go.mod files and the vendor directory
- update the method signatures for custom reporters

Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-07-08 10:44:46 +08:00
Claudiu Belu
87123c49a0 tests: Enables a few Conformance tests for Windows
Some of these tests could not be run previously, especially on Windows
Docker containers. But now, by using Windows Containerd, we can finally
run them:

- HostNetwork=true tests: This can now be enabled on Windows Privileged Containers.
- /etc/hosts related tests: These were not supported because it required single
  file mappings, which is possible in Containerd.
- termination message as non-root user: Requires RunAsUsername, and single file
  mappings.
2022-03-06 09:36:39 -08:00
ahrtr
fe95aa614c io/ioutil has already been deprecated in golang 1.16, so replace all ioutil with io and os 2022-02-03 05:32:12 +08:00
Tim Hockin
11a25bfeb6
De-share the Handler struct in core API (#105979)
* De-share the Handler struct in core API

An upcoming PR adds a handler that only applies on one of these paths.
Having fields that don't work seems bad.

This never should have been shared.  Lifecycle hooks are like a "write"
while probes are more like a "read". HTTPGet and TCPSocket don't really
make sense as lifecycle hooks (but I can't take that back). When we add
gRPC, it is EXPLICITLY a health check (defined by gRPC) not an arbitrary
RPC - so a probe makes sense but a hook does not.

In the future I can also see adding lifecycle hooks that don't make
sense as probes.  E.g. 'sleep' is a common lifecycle request. The only
option is `exec`, which requires having a sleep binary in your image.

* Run update scripts
2021-10-29 13:15:11 -07:00
Antonio Ojea
8e2eeffa79 PokeHTTP default timeout to avoid hanging connections 2021-06-02 22:38:12 +02:00
Pavithra Ramesh
2430f23445 Use a less-common port for e2e test http pod.
8080 is a common port that is more likely to cause conflicts when used
in hostNetwork mode for tests.
2021-04-22 13:17:10 -07:00
Niekvdplas
fec272a7b2 Fixed several spelling mistakes 2021-03-30 23:02:09 +02:00
Federico Paolinelli
a0ca1fd63f Network Tests: bind host network udp listeners to hostIPs
When listening on udp, the reply is sent using a src address which is
the address of the gateway interface. This means that when listening to
any, the reply can be sent out with a src ip which is different from the
request's target ip. This confuses natting and "connectionful" udp
services do not work.
Here, we force the endpoint to listen from the hostIP and from podIPs,
to cover both dual stack and legacy clusters.

Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
2021-03-09 11:52:35 +01:00
Antonio Ojea
638da25dd1 Revert "use uncommon ports for e2e network test"
This reverts commit be1ed2f43a.

The problem happens when the pod tries to be scheduled, not the
service. Also, maybe skipping is not the best idea ...
2020-12-14 08:56:16 +01:00
Kubernetes Prow Robot
379ed6644d
Merge pull request #96484 from aojea/e2etest
add e2e test for dual-stack secondary service IPs
2020-11-18 15:28:51 -08:00
Antonio Ojea
ad043f2bdd e2e dualstack test fixes
remove unused variables and fix comments
2020-11-16 23:18:30 +01:00
Antonio Ojea
be1ed2f43a use uncommon ports for e2e network test
since we added tests to check connectivity against pods with
hostNetwork: true, there is the possibility that those pods
fail to run because the port is being used in the host.

Current test were using port 8080,8081 and 8082 that are commonly
used in hosts for other applications.

If the service is not ready after a certain time, and we are using
Pods with hostNetwork: true we assume that there is a conflict
and skip this test.
2020-11-12 11:09:01 +01:00
Antonio Ojea
ed694a1bf6 add e2e test for dual-stack secondary service IPs
Dual stack services can have two ClusterIPs, we already have tests that
exercise the connectivity from different scenarios to the first
ClusterIP of the service.

This PR adds a new functionality to the e2e network utils to enable
DualStack services, and replicate the same tests but using the
secondary ClusterIP, so we cover the connectivity to both cluster IPs.
2020-11-12 10:07:04 +01:00
Kubernetes Prow Robot
a5bce462d0
Merge pull request #94812 from aojea/e2ehostnet2
e2e test for services using pods with hostNetwork as backend
2020-11-10 14:35:38 -08:00
knight42
3c4d6859c8
refactor: migrate health checks of control-plane off insecure port in tests
Signed-off-by: knight42 <anonymousknight96@gmail.com>
2020-10-31 11:39:25 +08:00
Antonio Ojea
734d5bbed0 e2e use functional options to configure NetworkingTest
NetworkingTest is used to test different network scenarios.
Since new capabilites and scenarios are added, like SCTP or HostNetwork
for pods, we need a way to configure it with minimum disruption and code
changes.

Go idiomatic way to achieve this is using functional options.
2020-10-26 22:18:05 +01:00
Antonio Ojea
d382f299a1 fix e2e service test container listening port
the e2e test container used for the "Networking Granular Checks: Services"
tests only needs to listen in one port to perform do network checks.
This port is unrelated to the other ports used in the test, so we may
use a different number to avoid possible conflicts.
2020-10-26 22:07:36 +01:00
Kubernetes Prow Robot
943b1dbf53
Merge pull request #95495 from deads2k/remove-secondary-retry
remove secondary client retries in e2e tests
2020-10-15 08:06:39 -07:00
David Eads
64c099d670 remove secondary client retries in e2e tests 2020-10-15 08:30:42 -04:00
jay vyas
e7a9a94da8 simpler addition of nodeport basic validation 2020-10-11 11:36:02 -04:00
jay vyas
8630dc924a Update test/e2e/framework/network/utils.go
add logging about min/max interval
Co-authored-by: Antonio Ojea <antonio.ojea.garcia@gmail.com>
2020-10-05 19:01:33 -04:00
jay vyas
56def96d9d Update DialFromNode to return values as is done w/ other tests. Update
comments to clarify missing probability check function (since they need
to be updated anyways b/c of the return value introduced)
2020-10-04 15:59:20 -04:00
jay vyas
4c52ce7f87 just log essential pod info 2020-10-01 08:32:41 -04:00
Vishwanath Sangale
b8e733fb94 Updated symbol 'framework.GetAllMasterAddresses' to not use word 'master' 2020-09-29 21:43:10 -07:00
jay vyas
60c8a36a7b Add failure logic to tests that rely on side-effect-free dial functions. 2020-09-23 09:36:23 -05:00
jay vyas
64548b3cfa Adding back in the breadth-first-polling logic.
"Revert "Merge pull request #93837 from jayunit100/DialFromContainerB""

This reverts commit f7a28c3904.
2020-09-23 09:09:38 -05:00
Antonio Ojea
f7a28c3904 Revert "Merge pull request #93837 from jayunit100/DialFromContainerB"
This reverts commit 61490bba46, reversing
changes made to 9ecab1b4b2.

Some methods from the networking e2e tools are dialing from a
containter to another container, and failing the test if there was no
connectivity. This PR modified the methods to return an error instead of
failing the test.
However, these methods were used by other tests in the framework, and
they are not checking if the method returns an error, expecting that
the method fail the test. With this change, any connectivity problem
will go unnoticed on the tests that are not asserting the error, so we
need to revert to previous state.
2020-09-22 21:53:10 +02:00
Kubernetes Prow Robot
3b568bbe5d
Merge pull request #94232 from swetharepakula/multiple-services
Add e2e multiple endpoint services test
2020-09-22 12:23:00 -07:00
Matthew Fenwick
81219ca9d2 address review comments 2020-09-02 21:49:45 -04:00
Swetha Repakula
e6428ae214 Add e2e multiple endpoint services test
- ensures that when multiple services with the same selector will
 function even if one of the services is deleted
2020-09-01 16:36:33 -07:00
jay vyas
9ecf96cb46 Add maxTries logging statement, otherwise the numbers are really hard to interpret 2020-08-11 12:28:08 -04:00
jay vyas
56e2adbd79 implement breadth first try 2020-08-11 11:32:46 -04:00
jay vyas
ccbfa84173 golint
flip logging messages

run pod->node conformance tests the same way
2020-08-10 15:46:49 -04:00
jay vyas
84f7d1e636 e2e test intra-pod breadth first logging and summary
gofmt
2020-08-09 16:35:03 -04:00