Commit Graph

42 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
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
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
Patrick Ohly
fdc03dd2f8 e2e kubectl: improve Gomega check
gomega.Succeed is the recommend way of checking for an error. gomega.BeNil
prints a less useful failure message.
2022-12-14 07:39:51 +01:00
Patrick Ohly
df5d84ae81 e2e: accept context from Ginkgo
Every ginkgo callback should return immediately when a timeout occurs or the
test run manually gets aborted with CTRL-C. To do that, they must take a ctx
parameter and pass it through to all code which might block.

This is a first automated step towards that: the additional parameter got added
with

    sed -i 's/\(framework.ConformanceIt\|ginkgo.It\)\(.*\)func() {$/\1\2func(ctx context.Context) {/' \
        $(git grep -l -e framework.ConformanceIt -e ginkgo.It )
    $GOPATH/bin/goimports -w $(git status | grep modified: | sed -e 's/.* //')

log_test.go was left unchanged.
2022-12-10 19:50:18 +01: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
Sergiusz Urbaniak
373c08e0c7
test/e2e/framework: configure pod security admission level for e2e tests 2022-03-28 15:42:10 +02: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
chymy
b250a985d2 Fix misspelling and misgrammar
Signed-off-by: chymy <chang.min1@zte.com.cn>
2021-06-05 05:02:17 -04:00
Sascha Grunert
c7648f5984
Deflake port-forward e2e test
We should read and verify the data before actually closing the
connection to avoid connection based-races within the test.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-05-13 08:53:31 +02:00
tanjunchen
aa9d06d79b test/e2e/framework:move OpenWebSocketForURL to subpackage(new) websocket 2020-03-24 22:54:35 +08:00
tanjunchen
bed22fbb44 WaitForPodReady is simply wrapper functions for e2epod package,
and they made an invalid dependency to sub e2e framework from the core framework.

So we can use e2epod.WaitTimeoutForPodReadyInNamespace to remove invalid dependency.

The main purpose of this pr is to handle the framework core package dependency subpackage pod.
2020-03-22 23:08:52 +08:00
Kubernetes Prow Robot
460fdc7f48
Merge pull request #87057 from oomichi/add-debugging-msg-issue86678
Add logs of port-forward-tester pod
2020-02-12 05:22:51 -08:00
Mike Danese
25651408ae generated: run refactor 2020-02-08 12:30:21 -05:00
Mike Danese
3aa59f7f30 generated: run refactor 2020-02-07 18:16:47 -08:00
Kenichi Omichi
beb252df16 Add logs of port-forward-tester pod
This adds logs of port-forward-tester pod for investigating a flake
test.
2020-01-10 03:44:02 +00:00
Kenichi Omichi
99b135442c Add error handling of CloseWrite()
The e2e test "Kubectl Port forwarding With a server listening .."
is failed sometimes due to the difference between expected data and
received data. To receive the data, the test does CloseWrite() but
it didn't have the corresponding error handling.
This adds it to investigate the issue more.
2020-01-10 03:14:39 +00:00
MorrisLaw
b85adbf1fd moved WriteFileViaContainer and ReadFileViaContainer to kubectl_utils 2019-12-04 20:31:57 +00:00
MorrisLaw
cd8da67b03 move KubectlCmd out of utils into its own package 2019-12-04 20:30:43 +00:00
carlory
5bbedd39c0 use log funcs of core framework in the auth, kubectl and windows pkg 2019-09-15 21:39:54 +08:00
Kubernetes Prow Robot
8bf4bdc7f3
Merge pull request #79910 from k-toyoda-pi/replace_KubeDescribe_e2e_kubectl
Replace KubeDescribe with ginkgo.Describe in e2e/kubectl
2019-08-22 23:27:16 -07:00
Sukeesh
346fdbccf0 Cleanup: Audit log and error capitalization 2019-07-08 20:20:12 +09:00
toyoda
baddd2fd3b Replace KubeDescribe with ginkgo.Describe in e2e/kubectl 2019-07-08 18:03:40 +09:00
Kubernetes Prow Robot
dc8b928136
Merge pull request #79162 from SataQiu/fix-test-20190619
Refactor: replace framework.Failf with e2elog.Failf
2019-06-21 12:17:04 -07:00
SataQiu
332be4b1e3 refactor: replace framework.Failf with e2elog.Failf 2019-06-19 17:52:35 +08:00
Claudiu Belu
9e81f3b50b tests: Replaces images used with agnhost (part 2)
Quite a few images are only used a few times in a few tests. Thus,
the images are being centralized into the agnhost image, reducing
the number of images that have to be pulled and used.

This PR replaces the usage of the following images with agnhost:

- net
- netexec
- nettest
- webhook
2019-06-17 06:04:18 -07:00
Claudiu Belu
bd8cb8fae0 tests: Replaces images used with agnhost (part 1)
Quite a few images are only used a few times in a few tests. Thus,
the images are being centralized into the agnhost image, reducing
the number of images that have to be pulled and used.

This PR replaces the usage of the following images with agnhost:

- fakegitserver
- hostexec
- liveness
- logs-generator
- no-snat-test
- no-snat-test-proxy
- port-forward-tester
2019-06-13 15:05:50 -07:00
Jorge Alarcon Ochoa
4969a05327 Refactored pod-related functions from framework/util.go
This a refactoring of framework/utils.go into framework/pod.

Signed-off-by: Jorge Alarcon Ochoa <alarcj137@gmail.com>
2019-05-30 09:30:26 -04:00
draveness
c045046e5b feat: use framework.ExpectNoError instead in e2e test 2019-05-10 09:53:10 +08:00
Jiatong Wang
3b5bedd7cf Modify e2e/kubectl tests to import e2elog.Log
Signed-off-by: Jiatong Wang <wangjiatong@vmware.com>
2019-05-06 00:23:59 -07:00
danielqsj
8911a2ddbb fix golint failures for test/e2e/kubectl 2019-02-26 18:27:01 +08:00
Kubernetes Prow Robot
d2bd29fcee
Merge pull request #70923 from m1kola/fix_e2e_err_message
Fixes error message in e2e tests for kubectl port-forward
2019-01-14 14:24:01 -08:00
Mikalai Radchuk
9cc47e3ba3 Fixes flaky tests for kubectl port-forward 2018-11-15 20:07:00 +00:00
Mikalai Radchuk
b73b5bc99c Fixes error message in e2e tests 2018-11-11 13:24:37 +00:00
Radek Pieczonka
4643c6e95e port-forward listen on address
adds an address flag to kubectl port-forward to allow to bind to a different ip then localhost
2018-10-07 22:18:18 +02:00
xiangpengzhao
eb27e1c471 Remove version check for kubectl portfoward. 2017-11-04 00:03:34 +08:00
Kevin
4c8539cece use core client with explicit version globally 2017-10-27 15:48:32 +08:00
Manjunath A Kumatagi
ee4d54c70c Port e2e tests for multi architecture 2017-09-01 05:40:52 +05:30
Phillip Wittrock
3c3c271d07 Import kubectl tests in e2e_test.go so they start running.
Also rename the Describe function
2017-07-13 15:10:17 -07:00
Phillip Wittrock
2b5b4d26ae Move kubectl e2e tests to their own directory and prefix the test names with [sig-cli] 2017-07-12 09:42:06 -07:00