Commit Graph

20 Commits

Author SHA1 Message Date
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
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
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
Sergey Kanzhelev
ee80dd19db fix the retry logic in ssh in test framework 2022-04-05 17:14:58 +00: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
Sascha Grunert
c1bac40880
Fix SIG Node SSH e2e test
This assumes that SSH via bastion works if the `KUBE_SSH_BASTION`
environment variable is set, which is the case for
`pull-kubernetes-e2e-gce-correctness`.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2021-07-21 15:57:14 +02:00
Sascha Grunert
9e372bffef
e2e: test SSH port on NodeSSHHosts
Before assuming that a certain host runs an SSH server, we now test its
`SSHPort` for connectivity. This means that the test `should be able to
run crictl on the node` can be now more failure proof by checking only
hosts where SSH actually runs. Beside that, we can also test all hosts
and not only the first one.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2021-05-11 08:32:09 +02:00
Benjamin Elder
56e092e382 hack/update-bazel.sh 2021-02-28 15:17:29 -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
Kenichi Omichi
48fdb95a82 Add common SSHPort on e2essh
There were several sshPort values in e2e test packages because
we've migrated code from e2e framework by copying and pastting.
This adds common SSHPort on e2essh package to reduce such duplicated
code.
2020-04-02 17:41:49 +00:00
Andrew Sy Kim
f26b8372f8 e2e/framework: implement ssh exec internally
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
2020-03-19 11:43:04 -04:00
tanjunchen
efec7e64ce remove TODO and use framework.SingleCallTimeout 2020-02-14 01:12:46 +08:00
Mike Danese
3aa59f7f30 generated: run refactor 2020-02-07 18:16:47 -08:00
Kenichi Omichi
0126d35df1 Rename e2e framework functions used locally
The following functions are used locally in e2e framework subpackages.
 - RunSSHCommandViaBastion
 - MakeNginxPod
 - LogPodTerminationMessages
 - CheckPodsCondition
 - SetNodeAffinityRequirement

This renames them to clarify them as local ones.
2019-10-12 00:06:49 +00:00
Matt Matejczyk
475a374822 Update NodeSSHHosts to support clusters with some public nodes
This is to support the setup where we have private nodes and one additional
heapster node with public IP. We plan to use this setup in our scale
tests.

Ref. https://github.com/kubernetes/kubernetes/issues/76374
2019-09-03 16:45:09 +02:00
John Schnake
338bc3ce42 Move framework ssh code to new package
The framework/ssh.go code was heavily used throughout the framework
and could be useful elsewhere but reusing those methods requires
importing all of the framework.

Extracting these methods to their own package for reuse.

Only a few methods had to be copied into this package from the
rest of the framework to avoid an import cycle.
2019-05-08 11:00:36 -05:00