Commit Graph

92 Commits

Author SHA1 Message Date
Patrick Ohly
4d63e7d4d6 e2e: remove unused label filter from WaitForPodsRunningReady
None of the users of the functions passed anything other than nil or an empty
map and the implementation ignore the parameter - it seems like a candidate for
simplification.
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
3ebab68c8a e2e: remove unused label filter from WaitForPodsRunningReady
None of the users of the functions passed anything other than nil or an empty
map and the implementation ignore the parameter - it seems like a candidate for
simplification.
2023-01-31 07:52:26 +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
d4729008ef e2e: simplify test cleanup
ginkgo.DeferCleanup has multiple advantages:
- The cleanup operation can get registered if and only if needed.
- No need to return a cleanup function that the caller must invoke.
- Automatically determines whether a context is needed, which will
  simplify the introduction of context parameters.
- Ginkgo's timeline shows when it executes the cleanup operation.
2022-12-13 08:09:01 +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
Patrick Ohly
dfdf88d4fa e2e: adapt to moved code
This is the result of automatically editing source files like this:

    go install golang.org/x/tools/cmd/goimports@latest
    find ./test/e2e* -name "*.go" | xargs env PATH=$GOPATH/bin:$PATH ./e2e-framework-sed.sh

with e2e-framework-sed.sh containing this:

sed -i \
    -e "s/\(f\|fr\|\w\w*\.[fF]\w*\)\.ExecCommandInContainer(/e2epod.ExecCommandInContainer(\1, /" \
    -e "s/\(f\|fr\|\w\w*\.[fF]\w*\)\.ExecCommandInContainerWithFullOutput(/e2epod.ExecCommandInContainerWithFullOutput(\1, /" \
    -e "s/\(f\|fr\|\w\w*\.[fF]\w*\)\.ExecShellInContainer(/e2epod.ExecShellInContainer(\1, /" \
    -e "s/\(f\|fr\|\w\w*\.[fF]\w*\)\.ExecShellInPod(/e2epod.ExecShellInPod(\1, /" \
    -e "s/\(f\|fr\|\w\w*\.[fF]\w*\)\.ExecShellInPodWithFullOutput(/e2epod.ExecShellInPodWithFullOutput(\1, /" \
    -e "s/\(f\|fr\|\w\w*\.[fF]\w*\)\.ExecWithOptions(/e2epod.ExecWithOptions(\1, /" \
    -e "s/\(f\|fr\|\w\w*\.[fF]\w*\)\.MatchContainerOutput(/e2eoutput.MatchContainerOutput(\1, /" \
    -e "s/\(f\|fr\|\w\w*\.[fF]\w*\)\.PodClient(/e2epod.NewPodClient(\1, /" \
    -e "s/\(f\|fr\|\w\w*\.[fF]\w*\)\.PodClientNS(/e2epod.PodClientNS(\1, /" \
    -e "s/\(f\|fr\|\w\w*\.[fF]\w*\)\.TestContainerOutput(/e2eoutput.TestContainerOutput(\1, /" \
    -e "s/\(f\|fr\|\w\w*\.[fF]\w*\)\.TestContainerOutputRegexp(/e2eoutput.TestContainerOutputRegexp(\1, /" \
    -e "s/framework.AddOrUpdateLabelOnNode\b/e2enode.AddOrUpdateLabelOnNode/" \
    -e "s/framework.AllNodes\b/e2edebug.AllNodes/" \
    -e "s/framework.AllNodesReady\b/e2enode.AllNodesReady/" \
    -e "s/framework.ContainerResourceGatherer\b/e2edebug.ContainerResourceGatherer/" \
    -e "s/framework.ContainerResourceUsage\b/e2edebug.ContainerResourceUsage/" \
    -e "s/framework.CreateEmptyFileOnPod\b/e2eoutput.CreateEmptyFileOnPod/" \
    -e "s/framework.DefaultPodDeletionTimeout\b/e2epod.DefaultPodDeletionTimeout/" \
    -e "s/framework.DumpAllNamespaceInfo\b/e2edebug.DumpAllNamespaceInfo/" \
    -e "s/framework.DumpDebugInfo\b/e2eoutput.DumpDebugInfo/" \
    -e "s/framework.DumpNodeDebugInfo\b/e2edebug.DumpNodeDebugInfo/" \
    -e "s/framework.EtcdUpgrade\b/e2eproviders.EtcdUpgrade/" \
    -e "s/framework.EventsLister\b/e2edebug.EventsLister/" \
    -e "s/framework.ExecOptions\b/e2epod.ExecOptions/" \
    -e "s/framework.ExpectNodeHasLabel\b/e2enode.ExpectNodeHasLabel/" \
    -e "s/framework.ExpectNodeHasTaint\b/e2enode.ExpectNodeHasTaint/" \
    -e "s/framework.GCEUpgradeScript\b/e2eproviders.GCEUpgradeScript/" \
    -e "s/framework.ImagePrePullList\b/e2epod.ImagePrePullList/" \
    -e "s/framework.KubectlBuilder\b/e2ekubectl.KubectlBuilder/" \
    -e "s/framework.LocationParamGKE\b/e2eproviders.LocationParamGKE/" \
    -e "s/framework.LogSizeDataTimeseries\b/e2edebug.LogSizeDataTimeseries/" \
    -e "s/framework.LogSizeGatherer\b/e2edebug.LogSizeGatherer/" \
    -e "s/framework.LogsSizeData\b/e2edebug.LogsSizeData/" \
    -e "s/framework.LogsSizeDataSummary\b/e2edebug.LogsSizeDataSummary/" \
    -e "s/framework.LogsSizeVerifier\b/e2edebug.LogsSizeVerifier/" \
    -e "s/framework.LookForStringInLog\b/e2eoutput.LookForStringInLog/" \
    -e "s/framework.LookForStringInPodExec\b/e2eoutput.LookForStringInPodExec/" \
    -e "s/framework.LookForStringInPodExecToContainer\b/e2eoutput.LookForStringInPodExecToContainer/" \
    -e "s/framework.MasterAndDNSNodes\b/e2edebug.MasterAndDNSNodes/" \
    -e "s/framework.MasterNodes\b/e2edebug.MasterNodes/" \
    -e "s/framework.MasterUpgradeGKE\b/e2eproviders.MasterUpgradeGKE/" \
    -e "s/framework.NewKubectlCommand\b/e2ekubectl.NewKubectlCommand/" \
    -e "s/framework.NewLogsVerifier\b/e2edebug.NewLogsVerifier/" \
    -e "s/framework.NewNodeKiller\b/e2enode.NewNodeKiller/" \
    -e "s/framework.NewResourceUsageGatherer\b/e2edebug.NewResourceUsageGatherer/" \
    -e "s/framework.NodeHasTaint\b/e2enode.NodeHasTaint/" \
    -e "s/framework.NodeKiller\b/e2enode.NodeKiller/" \
    -e "s/framework.NodesSet\b/e2edebug.NodesSet/" \
    -e "s/framework.PodClient\b/e2epod.PodClient/" \
    -e "s/framework.RemoveLabelOffNode\b/e2enode.RemoveLabelOffNode/" \
    -e "s/framework.ResourceConstraint\b/e2edebug.ResourceConstraint/" \
    -e "s/framework.ResourceGathererOptions\b/e2edebug.ResourceGathererOptions/" \
    -e "s/framework.ResourceUsagePerContainer\b/e2edebug.ResourceUsagePerContainer/" \
    -e "s/framework.ResourceUsageSummary\b/e2edebug.ResourceUsageSummary/" \
    -e "s/framework.RunHostCmd\b/e2eoutput.RunHostCmd/" \
    -e "s/framework.RunHostCmdOrDie\b/e2eoutput.RunHostCmdOrDie/" \
    -e "s/framework.RunHostCmdWithFullOutput\b/e2eoutput.RunHostCmdWithFullOutput/" \
    -e "s/framework.RunHostCmdWithRetries\b/e2eoutput.RunHostCmdWithRetries/" \
    -e "s/framework.RunKubectl\b/e2ekubectl.RunKubectl/" \
    -e "s/framework.RunKubectlInput\b/e2ekubectl.RunKubectlInput/" \
    -e "s/framework.RunKubectlOrDie\b/e2ekubectl.RunKubectlOrDie/" \
    -e "s/framework.RunKubectlOrDieInput\b/e2ekubectl.RunKubectlOrDieInput/" \
    -e "s/framework.RunKubectlWithFullOutput\b/e2ekubectl.RunKubectlWithFullOutput/" \
    -e "s/framework.RunKubemciCmd\b/e2ekubectl.RunKubemciCmd/" \
    -e "s/framework.RunKubemciWithKubeconfig\b/e2ekubectl.RunKubemciWithKubeconfig/" \
    -e "s/framework.SingleContainerSummary\b/e2edebug.SingleContainerSummary/" \
    -e "s/framework.SingleLogSummary\b/e2edebug.SingleLogSummary/" \
    -e "s/framework.TimestampedSize\b/e2edebug.TimestampedSize/" \
    -e "s/framework.WaitForAllNodesSchedulable\b/e2enode.WaitForAllNodesSchedulable/" \
    -e "s/framework.WaitForSSHTunnels\b/e2enode.WaitForSSHTunnels/" \
    -e "s/framework.WorkItem\b/e2edebug.WorkItem/" \
    "$@"

for i in "$@"; do
    # Import all sub packages and let goimports figure out which of those
    # are redundant (= already imported) or not needed.
    sed -i -e '/"k8s.io.kubernetes.test.e2e.framework"/a e2edebug "k8s.io/kubernetes/test/e2e/framework/debug"' "$i"
    sed -i -e '/"k8s.io.kubernetes.test.e2e.framework"/a e2ekubectl "k8s.io/kubernetes/test/e2e/framework/kubectl"' "$i"
    sed -i -e '/"k8s.io.kubernetes.test.e2e.framework"/a e2enode "k8s.io/kubernetes/test/e2e/framework/node"' "$i"
    sed -i -e '/"k8s.io.kubernetes.test.e2e.framework"/a e2eoutput "k8s.io/kubernetes/test/e2e/framework/pod/output"' "$i"
    sed -i -e '/"k8s.io.kubernetes.test.e2e.framework"/a e2epod "k8s.io/kubernetes/test/e2e/framework/pod"' "$i"
    sed -i -e '/"k8s.io.kubernetes.test.e2e.framework"/a e2eproviders "k8s.io/kubernetes/test/e2e/framework/providers"' "$i"
    goimports -w "$i"
done
2022-10-06 08:19: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
Sergiusz Urbaniak
373c08e0c7
test/e2e/framework: configure pod security admission level for e2e tests 2022-03-28 15:42:10 +02:00
AHMED AGHADI
ff0a3009db Improve checks for test/e2e/node and test/e2e/scheduling 2022-02-28 23:44:21 +05:30
Jan Chaloupka
b3249a1b39 e2e scheduling priorities: do not reference control loop variable
Otherwise, nodeNameToPodList[nodeName] list will have all its references
identical (corresponding to the control variable reference).
Thus, making all the pods in the list identical.
2021-09-23 13:08:03 +02:00
Aldo Culquicondor
be34dc95b5 Remove E2E test for NodePreferAvoidPods scheduling Score
The feature is now disabled by default. The annotation never graduated from alpha. The same behavior can be achieved with PreferNoSchedule taints.
2021-07-15 14:55:09 -04:00
Mike Dame
36cdb72eb6 (scheduler e2e) Create balanced pods in parallel 2021-05-27 16:01:18 -04:00
Mike Dame
07029c941a Remove Limits from scheduling e2e balanced pod resources
The purpose of the pod created by `createBalancedPodForNodes()` is to ensure
that all nodes have equal resource requests (as seen by the scheduler). This
prevents the default scheduling behavior (which attempts to balance resource requests)
from interfering with e2e's which test other priorities/score plugins.

Because the scheduler only worries about requests, specifying `Limits` in this pod
is unnecessary. In fact, if the calculated "balancing" limit is too low, it can cause
the balancing pod to never start due to OOMKill errors, leading to flakes and failures.
2021-04-21 15:58:00 -04:00
Kubernetes Prow Robot
2147937c41
Merge pull request #100128 from ingvagabund/sig-scheduling-single-node-e2e
[sig-scheduling] SchedulerPreemption|SchedulerPredicates|SchedulerPriorities: adjust some e2e tests to run in a single node cluster scenario
2021-04-13 10:31:09 -07:00
Mengxue Zhang
200ef16f1d list pod list once to avoid timeout 2021-04-06 13:44:11 +00:00
Jan Chaloupka
34c2672115 Skip PodTopologySpread tests in a single node cluster scenario 2021-03-11 12:32:09 +01:00
Kubernetes Prow Robot
84483a5aac
Merge pull request #98073 from damemi/fix-priority-balancedpods
(e2e/scheduler) Ensure minimum memory limit in createBalancedPodForNodes
2021-02-19 06:34:25 -08:00
Mike Dame
32b0333c15 (e2e/scheduler) Ensure minimum memory limit in createBalancedPodForNodes 2021-02-18 09:30:33 -05:00
Benjamin Elder
ad325377b5 shorten scheduling priorities taint key 2021-02-12 01:30:30 -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
Mike Dame
cc1eab1ca2 Move deferred taint cleanup call to ensure all are removed 2021-01-29 10:17:21 -05:00
Jan Chaloupka
2318992227 e2e: Pod should avoid nodes that have avoidPod annotation: clean remaining pods
The test is not cleaning all pods it created.
Memory balancing pods are deleted once the test namespace is.
Thus, leaving the pods running or in terminating state when a new test is run.
In case the next test is "[sig-scheduling] SchedulerPredicates [Serial] validates resource limits of pods that are allowed to run",
the test can fail.
2021-01-21 17:08:40 +01:00
David Eads
64c099d670 remove secondary client retries in e2e tests 2020-10-15 08:30:42 -04: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
Mike Dame
49464d9ec3 Balance node usage before creating victim pods in preemption e2e 2020-05-08 15:53:38 -04:00
tanjunchen
3b5ea194ea test/e2e/framework : move AddOrUpdateTaintOnNode to subpackage node 2020-04-29 21:29:38 +08:00
tanjunchen
6532b40f21 move function RemoveTaintOffNode in test/e2e/framework/util.go to subpackage node 2020-04-08 09:59:44 +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
tanjunchen
b5cdb6e6cb test/e2e/:remove // TODO: write a wrapper for ExpectNoErrorWithOffset() 2020-03-01 23:00:11 +08:00
Wei Huang
5da37d5b5e
Fix a scheduler e2e bug on PodTopologySpread scoring 2020-02-25 15:34:11 -08:00
Wei Huang
c93dffdfc4
E2E tests for PodTopologySpread 2020-02-14 16:48:35 -08:00
tanjunchen
c2c3c478cd test/e2e/framework:move functions to test/e2e/scheduling/ 2020-02-10 12:34:19 +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
s-ito-ts
4789e51d8e Use e2eskipper package in e2e/scheduling and e2e/servicecatalog 2020-01-14 01:54:25 +00:00
Wei Huang
b2159b5d66
Remove scheduler/algorithm/priorities/util package 2020-01-09 20:16:05 -08:00
Kubernetes Prow Robot
110da204f6
Merge pull request #85190 from danielqsj/f-event
refactor events utils in e2e
2020-01-07 22:35:40 -08:00
danielqsj
fc738cbb1d unify alias of api errors under test 2019-12-26 16:40:45 +08:00
SataQiu
50bc528a7e e2e: move LogFailedContainers out of e2e test framework util.go 2019-11-15 10:21:26 +08:00
danielqsj
ce34d0a49d refactor events utils in e2e 2019-11-13 16:03:17 +08:00
Kenichi Omichi
eb9d1cb5cc Move functions from e2e/framework/util.go Part-2
This PR moves functions from test/e2e/framework.util.go for making e2e
core framework small and simple:

- RestartKubeProxy: Moved to e2e network package
- CheckConnectivityToHost: Moved to e2e network package
- RemoveAvoidPodsOffNode: Move to e2e scheduling package
- AddOrUpdateAvoidPodOnNode: Move to e2e scheduling package
- UpdateDaemonSetWithRetries: Move to e2e apps package
- CheckForControllerManagerHealthy: Moved to e2e storage package
- ParseKVLines: Removed because of e9345ae5f0
- AddOrUpdateLabelOnNodeAndReturnOldValue: Removed because of ff7b07c43c
2019-11-06 03:59:28 +00:00
Kubernetes Prow Robot
e60fd899e4
Merge pull request #81982 from s-ito-ts/81427_e2e_scheduling
Use log functions of core framework on test/e2e/scheduling
2019-09-11 02:49:25 -07:00
s-ito-ts
4c69199aaa e2e test: Label all nodes in pod anti-affinity test. 2019-09-02 09:42:11 +00:00
s-ito-ts
8745f02015 Use log functions of core framework on test/e2e/scheduling 2019-08-30 06:27:42 +00:00
Mike Dame
a9f1314b60 Taints and tolerations e2e test re-work
Includes the changes from #80922 (that were reverted), and updates the test to appropriately add intolerable taints to all nodes except the target node
2019-08-15 11:00:24 -04:00
RaviSantosh Gudimetla
afce8f7f44
Revert "Toleration priority function score computation" 2019-08-12 12:03:04 -04:00
ravisantoshgudimetla
7c53ccfd68 Toleration priority function score computation
I think, if a pod doesn't have any tolerations, we don't prefer node without taints to
the one which has taints in https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/algorithm/priorities/taint_toleration.go#L29, so there is no point in testing that particular functionality. The side effect of the above is, since we're going round-robin in every scheduling cycle sometimes we're choosing first node and in the next cycle we'd move onto next node(where taints are not being applied), so it's causing problem unnecessarily
2019-08-02 14:18:25 -07:00
Jiatong Wang
e24a962821 Fix error log issue, remove OrDie suffix in methods naming 2019-07-17 23:18:21 -07:00
Jiatong Wang
0b37152f17 Refactor and Move node related methods to framework/node package
Signed-off-by: Jiatong Wang <wangjiatong@vmware.com>
2019-07-17 22:54:15 -07:00