Commit Graph

81 Commits

Author SHA1 Message Date
Maciej Szulik
17117dc47d
Replace context.TODO with proper context 2023-03-07 14:18:29 +01:00
Kubernetes Prow Robot
9f0b491953
Merge pull request #113270 from rrangith/fix/create-pvc-for-pending-pod
Automatically recreate PVC for pending STS pod
2023-03-03 10:24:58 -08:00
Justin SB
50a025acdb e2e: Remove dead code in tests
We were building a local pod variable that we were no longer using.

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
2023-03-01 08:08:33 -05:00
Patrick Ohly
3e760310b2 e2e: revise import restrictions
- test/e2e/framework/*.go should have very minimal dependencies.
  We can enforce that via import-boss.

- What each test/e2e/framework/* sub-package uses is less relevant,
  although ideally it also should be as minimal as possible in each case.

Enforcing this via import-boss ensures that new dependencies get flagged as
problem and thus will get additional scrutiny. It might be okay to add them,
but it needs to be considered.
2023-02-12 14:56:45 +01:00
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
Antonio Ojea
7f5ae1c0c1
Revert "e2e: wait for pods with gomega" 2023-02-06 12:08:22 +01:00
Kubernetes Prow Robot
85aa0057c6
Merge pull request #113298 from pohly/e2e-wait-for-pods-with-gomega
e2e: wait for pods with gomega
2023-02-04 05:26:29 -08:00
David Porter
83652673b6 test: Update runtime class detection logic
In the `NodeSupportsPreconfiguredRuntimeClassHandler`, update the check
for the runtime handler to return a failure if the
`/etc/containerd/config.toml` or `/etc/crio/crio.conf` config files do
not exist. If an error is returned, then the underlying test will be
skipped.

Test manually with starting a kind cluster and moving the containerd
config file and verifying that the test is skipped:

```
$ docker exec -it kind-worker /bin/bash
root@kind-worker:/# mv /etc/containerd/config.toml /etc/containerd/config.toml.bak
```

```
make WHAT="test/e2e/e2e.test"
$ ./_output/bin/e2e.test -kubeconfig /tmp/kubeconfig_kind -ginkgo.focus=".*should run a Pod requesting a RuntimeClass with a configured handler.*" --num-nodes=1 2>&1 -ginkgo.v=1 | tee -i "/tmp/build-log.txt"

[sig-node] RuntimeClass [It] should run a Pod requesting a RuntimeClass with a configured handler [NodeFeature:RuntimeHandler]
test/e2e/common/node/runtimeclass.go:85

  [SKIPPED] Skipping test as node does not have E2E runtime class handler preconfigured in container runtime config: command terminated with exit code 1
```

Signed-off-by: David Porter <david@porter.me>
2023-01-31 11:38:49 -08: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
David Porter
b96290c08f e2e node: Update runtime class handler skip logic
There are two runtime class tests which required the container runtime
config to include explicit configuration for `test-handler`. The current
logic skips these tests in non GCE environments. This skip is too strict
since the test is skipped in node e2e environments and in other
environments such as kind, which support running the test and also
configure `test-handler`.

Instead of skipping based on provider, add a new function
`NodeSupportsPreconfiguredRuntimeClassHandler` which examines the
underlying container runtime config and checks if the config includes
`test-handler`. The check is a bit brittle since it assumes container
runtime config paths, but it is a net improvement over skipping the test
entirely on non GCE environments.

This results in the test working in the common test environments, namely
GCE kube-up, node e2e, and kind.

Signed-off-by: David Porter <david@porter.me>
2023-01-24 14:43:24 -08:00
Rahul Rangith
e6a90aa48a PR feedback 2023-01-17 10:21:41 -05: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
Ang Gao
1931494333 make GetSubnetPrefix IP family agnostic 2022-12-12 01:26:42 +00:00
Patrick Ohly
3c162af45f e2e: skip AllNodesReady when the test skipped framework initialization
This addresses a problem caused by
https://github.com/kubernetes/kubernetes/pull/112043: because the AfterEach
which invokes AllNodesReady always runs, including tests that skipped early,
those tests ran into a nil pointer access. This increased the size of log
files. The tests still worked.
2022-10-17 10:27:14 +02: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
2d21acb1be e2e framework: eliminate redundant framework/[log|ginkgowrapper]
These sub packages were created by mistake. Logging and failure handling are
core features and must be implemented in the framework package.
2022-10-06 08:16:47 +02: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
Kubernetes Prow Robot
9254f94da1
Merge pull request #109413 from lzhecheng/flexible-internal-static-ip
[e2e][azure] Make internalStaticIP flexible
2022-05-12 03:43:14 -07:00
Patrick Ohly
e198c3a544 e2e: fix node wait test
Because these tests don't run in the CI, the test did not quite match the
actual code anymore. Apparently a retry mechanism was added after the test was
written.
2022-05-11 11:43:55 +02:00
Zhecheng Li
b4a3750912 [e2e][azure] Make internalStaticIP flexible
Now, internalStaticIP is hard-coded to "10.240.11.11". Such IP works
for aks-engine cluster but not for CAPZ ones (node-subnet 10.1.0.0/16)

Signed-off-by: Zhecheng Li <zhechengli@microsoft.com>
2022-04-15 10:08:36 +08:00
Ciprian Hacman
a0abe5aa33 Clean up dockershim in tests
Signed-off-by: Ciprian Hacman <ciprian@hakman.dev>
2021-12-22 13:05:34 +02:00
Jan Safranek
4efc9a9569 Fix zone calculation - consider only untainted nodes
Tests "Multi-AZ Cluster Volumes" should consider only nodes that are
schedulable and *untainted* when computing AZ where to run the tests.

GetReadySchedulableNodes() already filters schedulable + untainted nodes,
no need to do it again in GetSchedulableClusterZones().
2021-08-03 14:41:12 +02:00
Kubernetes Prow Robot
a0c83ba938
Merge pull request #103385 from ravisantoshgudimetla/fix-ubernetes-tests-2
[storage] [test] Ensure proper resource creation
2021-07-01 00:06:06 -07:00
ravisantoshgudimetla
67bc23411b [storage] [test] Ensure proper resource creation
Ensure resources are created in zone with schedulable
nodes. For example, if we have 4 zones with 3 zones
having worker nodes and 1 zone having master nodes(unscheduable
for workloads), we should not create resources like PV, PVC or
pods in that zone.
2021-06-30 18:01:57 -04:00
mgutierrez98
70124846fa control plane typo in node role path 2021-06-26 00:33:32 +00:00
mgutierrez98
80171465b3 Renamed variable containing master to control plane 2021-06-25 21:20:29 +00:00
Jack Francis
e67bce7077 test: retryable error in wait for ready nodes test 2021-05-07 12:19:36 -07:00
Benjamin Elder
56e092e382 hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
Kubernetes Prow Robot
23a46d8843
Merge pull request #97819 from damemi/bz1876918-priorities-test-refactor
Move deferred taint cleanup call to ensure all are removed
2021-02-06 21:37:12 -08:00
Clayton Coleman
286d989d8d
test/e2e: Allow test invokers to skip test waits before and after
A number of e2e tests are useful to run after the system has been
disrupted or is in the progress of being disrupted, but the current
suite and test logic blocks progress waiting for all nodes to be
healthy.

By passing -1 to --minStartupPods or --allowed-not-ready-nodes flags
the caller can bypass wait logic before and after test suites that
would prevent running e2e during disruption. This allows use of parts
of the e2e suite during cluster duress to verify that controllers or
components still function.
2021-02-04 20:14:05 -05:00
Mike Dame
cc1eab1ca2 Move deferred taint cleanup call to ensure all are removed 2021-01-29 10:17:21 -05:00
Antonio Ojea
ad043f2bdd e2e dualstack test fixes
remove unused variables and fix comments
2020-11-16 23:18:30 +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
7e62b1cab8
Merge pull request #96122 from cmluciano/cml/dualstackudpnode
dualstack: use correct IPFamily list for conntrack checks in e2e
2020-11-10 17:51:40 -08:00
Christopher M. Luciano
fa7a802d55
dualstack: use correct IPFamily list for conntrack checks in e2e
We hardcode the index number in the KubeProxy/Conntrack e2es and
CollectAddresses returns 4 mixed IP Family addresses in a dualstack
cluster. This change ensures that the serverNodeInfo.nodeIP has only
valid addresses for the expected IPFamily per test case.

Signed-off-by: Christopher M. Luciano <cmluciano@us.ibm.com>
2020-11-10 15:02:29 -05:00
Tim Hockin
819ff9b087
Use topology labels instead of old beta names (#96033)
* Rename const for topology.../zone

* Rename const for topology.../region

* Rename const for failure-domain.../zone

* Rename const for failure-domain.../region

* Restore old names for compat
2020-11-05 20:26:50 -08:00
David Eads
64c099d670 remove secondary client retries in e2e tests 2020-10-15 08:30:42 -04:00
tanjunchen
818238ae74 test/e2e/framework/:use the term 'Control Plane' in comment 2020-10-02 08:54:29 -07:00
Kubernetes Prow Robot
32f034de38
Merge pull request #92845 from oomichi/remove-DeprecatedMightBeMasterNode
Remove DeprecatedMightBeMasterNode()
2020-08-27 19:07:25 -07:00
jay vyas
04b38e9f91 Update wait function w/ descriptions of global node states, TODO for kubelet
API.
2020-08-19 13:55:54 -04:00
Kenichi Omichi
029b2d2197 Remove DeprecatedMightBeMasterNode()
This removes DeprecatedGetMasterAndWorkerNodes() usage from vsphere e2e
test as deprecated function cleanup.
Then all callers of DeprecatedMightBeMasterNode() have been removed.
So this removes DeprecatedMightBeMasterNode() itself also.
2020-07-11 03:18:44 +00:00
Kenichi Omichi
5edf15ea97 Use worker nodes for WaitForStableCluster()
WaitForStableCluster() checks all pods run on worker nodes, and the
function used to refer master nodes to skip checking controller plane
pods.
GetMasterAndWorkerNodes() was used for getting master nodes, but the
implementation is not good because it usesDeprecatedMightBeMasterNode().

This makes WaitForStableCluster() refer worker nodes directly to avoid
using GetMasterAndWorkerNodes().
2020-06-24 15:21:12 +00:00
Kenichi Omichi
13aae61789 Add isNodeSchedulableWithoutTainted()
For reducing usage of system.DeprecatedMightBeMasterNode(), this
adds isNodeSchedulableWithoutTainted().
2020-06-24 01:58:04 +00:00
tanjunchen
caddb3ffd3 test/e2e/framework:remove the direct dependency for k8s.io/kubernetes/pkg 2020-04-30 23:08:33 +08:00
tanjunchen
3b5ea194ea test/e2e/framework : move AddOrUpdateTaintOnNode to subpackage node 2020-04-29 21:29:38 +08:00
tanjunchen
87f2ef51f4 test/e2e/framework:remove direct k8s.io/kubernetes depedencies 2020-04-15 09:39:22 +08:00
Abdullah Gharaibeh
bed9b2f23b Cleanup obsolete NodeInfo methods 2020-04-12 18:13:46 -04:00
tanjunchen
6532b40f21 move function RemoveTaintOffNode in test/e2e/framework/util.go to subpackage node 2020-04-08 09:59:44 +08:00
Abdullah Gharaibeh
a5d8172715 move nodeinfo type to framework pkg 2020-04-07 10:25:24 -04:00