Commit Graph

78 Commits

Author SHA1 Message Date
Miciah Masters
af258c819d e2e: Remove kubeadm-ism in DNS HostNetwork test
The "[sig-network] DNS HostNetwork should resolve DNS of partial qualified
names for services on hostNetwork pods with dnsPolicy:
ClusterFirstWithHostNet" test assumes that a service named "kube-dns"
exists in the "kube-system" namespace.  This assumption is valid if the
cluster was configured using kubeadm, but the assumption may be invalid
otherwise.

As the test uses dnsPolicy: ClusterFirst (as opposed to dnsPolicy: None),
it does not need to specify the name server in dnsConfig.  Omitting
dnsConfig.nameservers obviates the need to look up the service.

Follow-up to commit add4652352.

* test/e2e/network/dns.go: Don't look up or use the kube-dns cluster IP
address as it might not exist on clusters that were not configured using
kubeadm.
2022-12-22 19:00:29 -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
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
Kubernetes Prow Robot
0ef0fa0e82
Merge pull request #112824 from gjkim42/promote-expandeddnsconfig-to-beta
Promote ExpandedDNSConfig feature to beta stage
2022-10-14 10:54:58 -07:00
Gunju Kim
add4652352
Promote ExpandedDNSConfig feature to the beta stage
This adds an e2e test for the feature and promotes ExpandedDNSConfig
feature to the beta stage.
2022-10-11 21:00:00 +09: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
Antonio Ojea
210c1302ef add e2e test for hostNetworl pods with dnsPolicy: ClusterFirstWithHostNet 2022-09-16 15:26:38 +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
a315ec3388
Merge pull request #108590 from claudiubelu/tests/enable-windows-tests
tests: Enables a few Conformance tests for Windows (part 1)
2022-04-04 08:56:11 -07:00
Sergiusz Urbaniak
373c08e0c7
test/e2e/framework: configure pod security admission level for e2e tests 2022-03-28 15:42:10 +02:00
Claudiu Belu
87123c49a0 tests: Enables a few Conformance tests for Windows
Some of these tests could not be run previously, especially on Windows
Docker containers. But now, by using Windows Containerd, we can finally
run them:

- HostNetwork=true tests: This can now be enabled on Windows Privileged Containers.
- /etc/hosts related tests: These were not supported because it required single
  file mappings, which is possible in Containerd.
- termination message as non-root user: Requires RunAsUsername, and single file
  mappings.
2022-03-06 09:36:39 -08:00
wojtekt
749922fa46 Cleanup SIGDescribe in test/e2e/network 2021-02-27 20:29:27 +01:00
Claudiu Belu
d37cbeb388 tests: Refactors agnhost image pod usage - network
A previous commit created a few agnhost related functions that creates agnhost
pods / containers for general purposes.

Refactors tests to use those functions.
2020-09-26 05:56:31 -07:00
Jefftree
ace97738e2 Update formatting of conformance comment 2020-07-29 20:50:44 -07:00
Kenichi Omichi
5c77461733 Move NewAgnhostPod() to e2e/network
because the function is called in e2e/network tests only.
2020-03-24 05:46:49 +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
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
Mike Danese
aaf855c1e6 deref all calls to metav1.NewDeleteOptions that are passed to clients.
This is gross but because NewDeleteOptions is used by various parts of
storage that still pass around pointers, the return type can't be
changed without significant refactoring within the apiserver. I think
this would be good to cleanup, but I want to minimize apiserver side
changes as much as possible in the client signature refactor.
2020-03-05 14:59:46 -08:00
Mike Danese
c58e69ec79 automated refactor 2020-03-05 14:59:46 -08:00
Claudiu Belu
c57f20b712 tests: Replaces dnsutils image used with agnhost (part 4)
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:

- dnsutils

dnsmasq is a Linux specific binary. In order for the tests to also
pass on Windows, CoreDNS should be used instead.
2020-02-26 21:51:23 -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
tanjunchen
586e1f2325 e2e/network/: Use e2eskipper package 2020-01-11 12:05:10 +08:00
tanjunchen
d51b72d9e9 fix staticcheck in test/e2e/network/ 2019-12-05 13:58:28 +08:00
Sascha Grunert
5a8b695fef
Validate AgnhostPod readyness status in e2e tests
We now additionally check if the agnhost pods are ready before
marking the pod as running to increase the overall test stability.

Relates to: https://github.com/kubernetes/kubernetes/pull/82420
Fixes: https://github.com/kubernetes/kubernetes/issues/82445

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-10-10 14:11:06 +02:00
Kubernetes Prow Robot
c449359119
Merge pull request #74977 from mgdevstack/master-conformance-pqdn
Promote DNS e2e verifying PQDN resolution for cluster
2019-09-26 14:39:36 -07:00
hwdef
af16366001 use log func in test/e2e/network 2019-09-13 17:54:51 +08:00
Mayank Gaikwad
eb07002d41 Promote PQDN for services DNS e2e to Conformance 2019-09-06 02:14:46 +05:30
Antonio Ojea
45d6f08868
Add a method to TestContext to check if is IPv6 2019-08-27 15:41:10 +02:00
Antonio Ojea
930a1321da
DNS e2e tests differentiate between IP family
The e2e DNS tests differentiate between IP family to
avoid false positives with dual stack clusters.
2019-08-27 12:57:40 +02:00
Mayank Gaikwad
78741f149a Modify dns e2e to individualise GCE specific dns checks into seperate e2e 2019-08-16 22:12:29 +05:30
draveness
c38ae01f8e feat: move service_util to separated package 2019-07-19 08:32:39 +08:00
SataQiu
332be4b1e3 refactor: replace framework.Failf with e2elog.Failf 2019-06-19 17:52:35 +08:00
Kubernetes Prow Robot
16bc6c1d02
Merge pull request #74982 from mgdevstack/promote-dns-hostname
Promote DNS e2e verifying DNS resolution for hostname and subdomain
2019-06-13 19:13:11 -07:00
SataQiu
d3a902ff5b e2e refactor: cleanup Logf form framework/util 2019-05-24 16:39:46 +08:00
Kubernetes Prow Robot
a7f13bcaf0
Merge pull request #77901 from k-toyoda-pi/use_expect_no_error_e2e_network_1
use framework.ExpectNoError() for e2e/network
2019-05-17 21:51:07 -07:00
Kubernetes Prow Robot
109d61f844
Merge pull request #75758 from mgdevstack/pqdn-service-linuxonly
Add [LinuxOnly] tag to few e2e verifying dns resolution
2019-05-16 16:26:40 -07:00
Mayank Gaikwad
64f2c68948 Add [LinuxOnly] to e2e verifying PQDN resolution 2019-05-16 20:07:37 +05:30
toyoda
ba4119a07b use framework.ExpectNoError() for e2e/network 2019-05-15 13:33:13 +09:00
Mayank Gaikwad
fc2af0e5a4 Promote e2e verifying DNS resolution for o pod's fqdn, hostname and subdomain 2019-05-14 23:53:00 +05:30
Kubernetes Prow Robot
2926505fff
Merge pull request #77503 from mgdevstack/master-subdomain-e2e
Add subdomain entry to verify dns resolution
2019-05-13 23:19:07 -07:00
SataQiu
515f8342d3 fix golint failures of test/e2e/network 2019-05-11 22:29:40 +08:00
Kubernetes Prow Robot
eacae8540a
Merge pull request #76508 from bclau/tests/agnhost-custom-dns-test
tests: Adds configurable pod DNS nameservers and search list test
2019-05-07 14:30:49 -07:00
Mayank Gaikwad
831939b65e Add subdomain to verify dns resolution by subdomain 2019-05-06 16:47:02 +05:30
Kubernetes Prow Robot
a26709ecee
Merge pull request #76061 from towolf/dynamic-cluster.local
test/e2e/network: Honor --dns-domain in more places
2019-05-03 17:01:38 -07:00
Kubernetes Prow Robot
6f1fd17b7a
Merge pull request #77366 from johnSchnake/frameworkLogRefactoring
Move auth and network tests to use framework/log
2019-05-03 08:53:19 -07:00
Tobias Wolf
e3299d5f6a test/e2e/network: Honor --dns-domain in more places
Try to finish what commit 4c8a65ac01 started; that is, do not assume
cluster.local is a constant base domain, when it is configurable.

This makes DNS e2e tests pass with --dns-domain, which was only being honored
for some tests, not all

Signed-off-by: Tobias Wolf <towolf@gmail.com>
2019-05-03 17:02:16 +02:00
John Schnake
0c62f751b6 Move auth and network tests to use framework/log
This is part of the transition to using framework/log instead
of the Logf inside the framework package. This will help with
import size/cycles when importing the framework or subpackages.
2019-05-03 08:41:21 -05:00
Kubernetes Prow Robot
75546a0166
Merge pull request #75591 from bclau/tests/split-hosts-entries
tests: Splits hostname from DNS test
2019-05-02 14:18:20 -07:00