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
Patrick Ohly
1e346c4e4a
e2e pod: convert ProxyResponseChecker into matcher
...
Instead of pod responses being printed to the log each time polling fails, we
get a consolidated failure message with all unexpected pod responses if (and
only if) the check times out or a progress report gets produced.
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
5d8e970be6
e2e pod: convert ProxyResponseChecker into matcher
...
Instead of pod responses being printed to the log each time polling fails, we
get a consolidated failure message with all unexpected pod responses if (and
only if) the check times out or a progress report gets produced.
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
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
Stephen Heywood
5ad48780ae
Promote ServiceAccount e2e test to Conformance
2022-10-10 12:12:17 +13: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
Stephen Heywood
a3f7da0421
Create e2e test for ServiceAccount endpoint
...
e2e test validates the following 1 endpoint
- replaceCoreV1NamespacedServiceAccount
2022-10-04 09:21:25 +13: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
kidddddddddddddddddddddd
6791ba2590
test/e2e/auth: enhance assertions
2022-05-07 11:58:06 +08:00
Sergiusz Urbaniak
373c08e0c7
test/e2e/framework: configure pod security admission level for e2e tests
2022-03-28 15:42:10 +02:00
Jordan Liggitt
654dc8686b
Exercise Get of serviceaccount in e2e
2022-03-16 20:24:50 -04:00
Shihang Zhang
fb6c727fde
no auto-generation of secret-based service account token
2022-02-23 14:17:30 -08:00
Michael Taufen
b33cd86a27
Update tests to use agnhost 2.32
...
Updates e2e tests to use agnhost 2.32, which fixes an issue with the
conformance tests for ServiceAccountIssuerDiscovery.
Original fix: https://github.com/kubernetes/kubernetes/pull/101589
Image promotion: https://github.com/kubernetes/k8s.io/pull/1994
2021-05-03 14:23:46 -07:00
Shihang Zhang
5d1774e9db
promote RootCAConfigMap e2e test to Conformance
2021-02-22 10:37:41 -08:00
Michael Taufen
f3e223cbbc
Promote ServiceAccountIssuerDiscovery test to conformance
...
This satisfies the graduation criteria for promoting
ServiceAccountIssuerDiscovery to GA, per the KEP:
https://github.com/kubernetes/enhancements/tree/master/keps/sig-auth/1393-oidc-discovery
The test only uses GA APIs and has been passing for well
over two weeks:
https://testgrid.k8s.io/sig-release-master-blocking#gce-cos-master-alpha-features&include-filter-by-regex=ServiceAccountIssuerDiscovery
2021-02-05 16:05:15 -08:00
Michael Taufen
05439d48aa
Tolerate disabled RBAC in ServiceAccountIssuerDiscovery test
...
Also clean up the binding after the test.
2021-02-05 10:59:18 -08:00
Michael Taufen
cf809c37c4
Move ServiceAccountIssuerDiscovery test into main e2e suite
...
By removing feature tag. In preparation for GA.
2021-01-29 16:18:26 -08:00
Shihang Zhang
22ae49bb5d
Promote TokenRequest e2e test to Conformance
2020-11-06 13:51:48 -08:00
Shihang Zhang
d40f0c43c4
separate RootCAConfigMap from BoundServiceAccountTokenVolume
2020-11-04 17:10:39 -08:00
Shihang Zhang
ff641f6eb2
mv TokenRequest and TokenRequestProjection to GA
2020-10-29 20:47:01 -07:00
Shihang Zhang
637235e893
upgrade test for BoundServiceAccountTokenVolume
2020-09-24 09:55:05 -07:00
hasheddan
7b0b5cb8d1
Fix minor typo in projected service account e2e test
...
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-06-01 14:10:09 -05:00
Kubernetes Prow Robot
57b0c310b7
Merge pull request #90390 from ii/promote-serviceaccount-resource-lifecycle-test
...
Promote ServiceAccount resource lifecycle test - +3 conformance coverage
2020-05-20 16:44:33 -07:00
Shihang Zhang
3db7275b54
set proper file permission for projected service account volume
2020-05-04 18:25:23 -07:00
Caleb Woodbine
bd9269f444
Fix formatting
2020-04-30 14:21:04 +12:00
Caleb Woodbine
e09e781a0c
Promote ServiceAccount resource lifecycle test
2020-04-23 16:32:54 +12:00
Kubernetes Prow Robot
c13a9401ca
Merge pull request #90193 from ii/create-serviceaccount-resource-lifecycle-test
...
Create ServiceAccount resource lifecycle test - +3 endpoint coverage
2020-04-22 19:22:00 -07:00
Kubernetes Prow Robot
fc9d174102
Merge pull request #88248 from claudiubelu/tests/reduce-to-agnhost-mounttest
...
tests: Replaces mounttest images used with agnhost (part 4)
2020-04-22 04:53:52 -07:00
Caleb Woodbine
9a53b0ec57
Add check for error in listing ServiceAccounts
2020-04-22 12:08:00 +12:00
Caleb Woodbine
c6e1701bda
Add checks to watches; Update to patch different subproperty
2020-04-22 10:45:17 +12:00
Caleb Woodbine
23d4367cff
Add ServiceAccount resource lifecycle test
2020-04-16 16:34:59 +12:00
Kubernetes Prow Robot
988982a1f7
Merge pull request #88048 from mtaufen/provider-info-e2etest
...
Add e2e test for validating JWTs as OIDC tokens
2020-03-06 17:59:34 -08:00
Mike Danese
c58e69ec79
automated refactor
2020-03-05 14:59:46 -08:00
Charles Eckman
aee9fde751
Add e2e test for validating JWTs as OIDC tokens
...
Adds an E2E test to deploy an agnhost container that runs the test.
Co-authored-by: Michael Taufen <mtaufen@google.com>
2020-03-05 13:58:52 -08:00
Claudiu Belu
1b71b2a9a2
tests: Replaces mounttest images 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:
- mounttest
- mounttest-user
Additionally, removes the usage of the mounttest-user image and removes
it from kubernetes/test/images. RunAsUser is set instead of having that image.
2020-02-29 15:05:57 -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
MorrisLaw
b85adbf1fd
moved WriteFileViaContainer and ReadFileViaContainer to kubectl_utils
2019-12-04 20:31:57 +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
ClarkLee
b94b1672f9
Use ExpectEqual in e2e/auth
2019-07-04 11:41:20 +08:00
Claudiu Belu
c752ea8134
tests: Replaces images used with agnhost (part 3)
...
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:
- audit-proxy
- crd-conversion-webhook
- entrypoint-tester
- inclusterclient
- iperf
- porter
- serve-hostname
2019-06-26 13:33:55 -07:00
SataQiu
332be4b1e3
refactor: replace framework.Failf with e2elog.Failf
2019-06-19 17:52:35 +08: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
SataQiu
d3a902ff5b
e2e refactor: cleanup Logf form framework/util
2019-05-24 16:39:46 +08:00
Mike Danese
96ed93d889
BoundServiceAccountTokenVolume: add e2e test
2019-05-14 09:43:45 -07:00
SataQiu
a4825d1cb8
fix golint failures of test/e2e/auth
2019-05-12 22:57:24 +08: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