Commit Graph

282 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
04e7021d06
Merge pull request #114625 from Divya063/feature-private-image-registry
[E2E] Add support for pulling images from private registry
2023-02-28 06:27:17 -08:00
Divya Rani
a8b1e57246 add support for pulling images from private registry 2023-02-28 00:40:51 -08:00
Kubernetes Prow Robot
d863d04adc
Merge pull request #114580 from pohly/e2e-ginkgo-timeout-fixes
e2e ginkgo timeout fixes, III
2023-01-30 13:48:48 -08:00
Patrick Ohly
db394db398 e2e: move several timeouts from TestContext into TimeoutContext
This consolidates timeout handling. In the future, configuration of all
timeouts via a configuration file might get added. For now, the same three
legacy command line flags for the timeouts that get moved continue to be
supported.
2023-01-09 17:29:35 +01:00
Patrick Ohly
f0cc053544 e2e framework: enable extending TimeoutContext
If we were to add new fields in TimeoutContext, the current users of
NewFrameworkWithCustomTimeouts might run into failures unless they get modified
to also set those new fields. This is error-prone.

A better approach is to let users of NewFrameworkWithCustomTimeouts override
fields by setting just those and use the normal defaults for the others.
2023-01-03 17:01:33 +01:00
Patrick Ohly
a51999e951 e2e framework: support Ginkgo decorators for framework.ConformanceIt
Additional parameters like ginkgo.SpecTimeout may also be relevant for
conformance tests.
2022-12-19 13:53:08 +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
73b60ba769 e2e framework: don't fail when DumpAllNamespaceInfo is nil
It is set in all of the test/e2e* suites, but not in the ginkgo output
tests. This check is needed before adding a test case there which would trigger
this nil pointer access.
2022-12-12 11:30:07 +01: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
70d0824f01 e2e framework: move resource gathering into framework/debug
This helps getting rid of the ssh dependency. The same init package as for
dumping namespaces takes care of adding the functionality back to framework
instances.
2022-10-06 08:16:47 +02:00
Patrick Ohly
f9bc4f837b e2e framework: move log size verification into framework/debug
This helps getting rid of the ssh dependency. The same init package as for
dumping namespaces takes care of adding the functionality back to framework
instances.
2022-10-06 08:16:47 +02:00
Patrick Ohly
802451b6ca e2e framework: move metrics gathering into sub package
This reduces the size of the test/e2e/framework itself. Because it does not
gather metrics data anymore by default, E2E test suites must set their
callbacks function or set the original one by importing
"k8s.io/kubernetes/test/e2e/framework/todo/metrics/init".
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
c45a924c5e e2e framework: move dumping of information into sub package
This reduces the size of the test/e2e/framework itself. Because it does not
dump anything anymore by default, E2E test suites must set their own dump
function or set the original one by importing
"k8s.io/kubernetes/test/e2e/framework/debug/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
Patrick Ohly
37d562b454 e2e framework: support callbacks during framework creation and before each test
This will be used as mechanism for invoking some of the code which is currently
hard-coded in the framework once that code is placed in optional packages.
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
Patrick Ohly
84990d53cf e2e: improve description of framework callbacks
When Ginkgo shows a BeforeEach/AfterEach/DeferCleanup, then it can only show
the source code where the callback was registered because there is no
description parameter. This can be improved by passing a custom CodeLocation.

Because a description like "set up framework" might not be enough, the source
code is still shown, too.
2022-09-13 14:27:32 +02:00
Patrick Ohly
fc092eb145 e2e: remove cleanup actions
The framework.AddCleanupAction API was a workaround for Ginkgo v1 not invoking
AfterEach callbacks after a test failure. Ginkgo v2 not only fixed that, but
also added a DeferCleanup API which can be used to run some code if (and only
if!) the corresponding setup code ran. In several cases that makes the test
cleanup simpler.
2022-09-09 13:51:07 +02:00
Patrick Ohly
53e1c7b4c3 e2e framework: remove AddAfterEach
For cleanup purposes the ginkgo.DeferCleanup is a better replacement for
f.AddAfterEach:
- the cleanup only gets executed when the corresponding setup code ran
  and can use the same local variables
- the callback runs after the test and before the framework
  deletes namespaces (as before)
- if one callback fails, the others still get executed

For the original purpose (https://github.com/kubernetes/kubernetes/pull/86177 "This is
very useful for custom gathering scripts.") it is now possible to use
ginkgo.AfterEach because it will always get executed. Just beware that its
callbacks run in first-in-first-out order.
2022-09-08 22:50:01 +02:00
Patrick Ohly
cbf94307ef e2e framework: clean up instance after all other code ran
In contrast to ginkgo.AfterEach, ginkgo.DeferCleanup runs the callback in
first-in-last-out order. Using it makes the following test code work as
expected:

    f := framework.NewDefaultFramework("some test")

    ginkgo.AfterEach(func() {
        // do something with f.ClientSet
    })

Previously, f.ClientSet was already set to nil by the framework's cleanup code.
2022-09-08 22:50:01 +02:00
Antonio Ojea
fc6acb2350 Revert "Revert the workaround needed to cleanup for Ginkgo V1"
This reverts commit 6a82ba82b1.
2022-07-20 10:48:35 +02:00
Dave Chen
6a82ba82b1 Revert the workaround needed to cleanup for Ginkgo V1
Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-07-11 14:49:40 +08:00
alingse
3bf9a559b6 fix pass []any as any in variadic function 2022-07-09 18:53:54 +08:00
Dave Chen
fd4b5b629b Stop using the deprecated method CurrentGinkgoTestDescription
Besides, the using of method might lead to a `concurrent map writes`
issue per the discussion here: https://github.com/onsi/ginkgo/issues/970

Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-07-08 10:46:11 +08:00
Dave Chen
20498fd65d Generate conformance test spec with offset decorator
`FullStackTrace` is not available in v2 if no exception found
with test execution.

The change is needed for conformance test's spec validation.

pls see: https://github.com/onsi/ginkgo/issues/960 for details.

Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-07-08 10:46:11 +08:00
Dave Chen
2eb8e9e81f ginkgo.It doesn't have a timeout arg anymore
Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-07-08 10:44:53 +08: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
Jordan Liggitt
410ac59c0d Remove PodSecurityPolicy admission plugin 2022-05-04 16:00:56 -04:00
Sergiusz Urbaniak
f578b9a40d
test/e2e/framework: use restricted policy by default 2022-04-04 13:58:59 +02:00
Sergiusz Urbaniak
e06e6771ef
test/e2e/framework: add pod security admission configuration 2022-03-28 15:42:04 +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
Clayton Coleman
1608fc5e88
e2e: Wait for kube-root-ca.crt to be created
The change from service account secrets to projected tokens and
the new dependency on kube-root-ca.crt to start pods with those
projected tokens means that e2e tests can start before
kube-root-ca.crt is created in a namespace. Wait for the default
service account AND the kube-root-ca.crt configmap in normal
e2e tests.
2022-01-25 14:23:31 -05:00
Patrick Ohly
5e9076da93 e2e: grab controller and scheduler metrics via port forwarding
The previous approach with grabbing via a nginx proxy had some
drawbacks:
- it did not work when the pods only listened on localhost (as
  configured by kubeadm) and the proxy got deployed on a different
  node
- starting the proxy raced with starting the pods, causing
  sporadic test failures because the proxy was not set up
  properly unless it saw all pods when starting the e2e.test
- the proxy was always started, whether it is needed or not
- the proxy was left running after a test and then the next
  test run triggered potentially confusing messages when
  it failed to create objects for the proxy

The new approach is similar to "kubectl port-forward" + "kubectl get
--raw". It uses the port forwarding feature to establish a TCP
connection via a custom dialer, then lets client-go handle TLS and
credentials.

Somehow verifying the server certificate did not work. As this
shouldn't be a big concern for E2E testing, certificate checking gets
disabled on the client side instead of investigating this further.
2021-06-16 12:02:40 +02:00
Grant Griffiths
564e531aa7 Add Snapshot Controller e2e metric tests
Signed-off-by: Grant Griffiths <ggriffiths@purestorage.com>
2021-05-20 23:29:23 -07:00
wojtekt
d4883f532e Remove KubeDescribe 2021-03-04 07:54:53 +01:00
llhuii
f713cbc4a4 Remove unused code in e2e/framework/framework.go 2021-03-03 10:03:21 +08:00
Fabio Bertinatto
3ec93da1b5 e2e: add custom timeouts to E2E framework 2020-12-02 15:57:58 -03:00
Marek Siarkowicz
7f59610f49 Add datapolicy tags to test/e2e/framework 2020-10-29 18:08:32 +01:00
Hemant Kumar
c4ce420667 Prevent deletion of namespace again 2020-09-09 11:22:08 -04:00
Kenichi Omichi
d191660c25 Use e2epod.WaitForPodTerminatedInNamespace directly
WaitForPod*() are just wrapper functions for e2epod package, and they
made an invalid dependency to sub e2e framework from the core framework.
So this replaces WaitForPodTerminated() with the e2epod function.
2020-03-22 17:43:33 +00: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
d23310a40e
Merge pull request #89324 from tanjunchen/remove-invalid-dependency-waitForPod-002
use e2epod.WaitForPodRunningInNamespaceSlow directly
2020-03-22 00:36:44 -07:00
tanjunchen
aa52bfe4d6 use e2epod.WaitForPodRunningInNamespaceSlow directly 2020-03-21 15:51:49 +08:00
tanjunchen
d18e6569e0 use e2epod.WaitForPodNotFoundInNamespace directly 2020-03-21 15:11:40 +08:00
Kubernetes Prow Robot
d3b2199b2f
Merge pull request #89321 from oomichi/WaitForPodNoLongerRunning
Use e2epod.WaitForPodNoLongerRunningInNamespace directly
2020-03-20 20:00:53 -07:00
Kubernetes Prow Robot
a26f50a52e
Merge pull request #86679 from oomichi/remove-invalid-dependency-27
Use e2epod.WaitForPodNameRunningInNamespace directly
2020-03-20 15:58:44 -07:00
Kenichi Omichi
12ff8f2861 Use e2epod.WaitForPodNoLongerRunningInNamespace directly
WaitForPod*() are just wrapper functions for e2epod package, and they
made an invalid dependency to sub e2e framework from the core framework.
So this replaces WaitForPodNoLongerRunning() with the e2epod function.
2020-03-20 21:05:01 +00:00
drfish
f5450543e0 Remove framework.go's dependency on e2e node sub fw 2020-03-20 10:01:51 +08:00
Kenichi Omichi
2c8955fd4a Use e2epod.WaitForPodNameRunningInNamespace directly
WaitForPod*() are just wrapper functions for e2epod package, and they
made an invalid dependency to sub e2e framework from the core framework.
So this replaces WaitForPodRunning() with the e2epod function.
2020-03-17 00:13:14 +00:00