mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
fix client-side specification of timeout now that it is honored
This commit is contained in:
parent
493bc79c04
commit
9b31985b08
@ -106,8 +106,7 @@ var _ = SIGDescribe("Advanced Audit", func() {
|
|||||||
|
|
||||||
podChan, err := f.PodClient().Watch(watchOptions)
|
podChan, err := f.PodClient().Watch(watchOptions)
|
||||||
framework.ExpectNoError(err, "failed to create watch for pods")
|
framework.ExpectNoError(err, "failed to create watch for pods")
|
||||||
for range podChan.ResultChan() {
|
podChan.Stop()
|
||||||
}
|
|
||||||
|
|
||||||
f.PodClient().Update(pod.Name, updatePod)
|
f.PodClient().Update(pod.Name, updatePod)
|
||||||
|
|
||||||
@ -159,7 +158,7 @@ var _ = SIGDescribe("Advanced Audit", func() {
|
|||||||
}, {
|
}, {
|
||||||
Level: auditinternal.LevelRequest,
|
Level: auditinternal.LevelRequest,
|
||||||
Stage: auditinternal.StageResponseStarted,
|
Stage: auditinternal.StageResponseStarted,
|
||||||
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/pods?timeoutSeconds=%d&watch=true", namespace, watchTestTimeout),
|
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/pods?timeout=%ds&timeoutSeconds=%d&watch=true", namespace, watchTestTimeout, watchTestTimeout),
|
||||||
Verb: "watch",
|
Verb: "watch",
|
||||||
Code: 200,
|
Code: 200,
|
||||||
User: auditTestUser,
|
User: auditTestUser,
|
||||||
@ -171,7 +170,7 @@ var _ = SIGDescribe("Advanced Audit", func() {
|
|||||||
}, {
|
}, {
|
||||||
Level: auditinternal.LevelRequest,
|
Level: auditinternal.LevelRequest,
|
||||||
Stage: auditinternal.StageResponseComplete,
|
Stage: auditinternal.StageResponseComplete,
|
||||||
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/pods?timeoutSeconds=%d&watch=true", namespace, watchTestTimeout),
|
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/pods?timeout=%ds&timeoutSeconds=%d&watch=true", namespace, watchTestTimeout, watchTestTimeout),
|
||||||
Verb: "watch",
|
Verb: "watch",
|
||||||
Code: 200,
|
Code: 200,
|
||||||
User: auditTestUser,
|
User: auditTestUser,
|
||||||
@ -233,8 +232,7 @@ var _ = SIGDescribe("Advanced Audit", func() {
|
|||||||
|
|
||||||
deploymentChan, err := f.ClientSet.AppsV1().Deployments(namespace).Watch(watchOptions)
|
deploymentChan, err := f.ClientSet.AppsV1().Deployments(namespace).Watch(watchOptions)
|
||||||
framework.ExpectNoError(err, "failed to create watch for deployments")
|
framework.ExpectNoError(err, "failed to create watch for deployments")
|
||||||
for range deploymentChan.ResultChan() {
|
deploymentChan.Stop()
|
||||||
}
|
|
||||||
|
|
||||||
_, err = f.ClientSet.AppsV1().Deployments(namespace).Update(d)
|
_, err = f.ClientSet.AppsV1().Deployments(namespace).Update(d)
|
||||||
framework.ExpectNoError(err, "failed to update audit-deployment")
|
framework.ExpectNoError(err, "failed to update audit-deployment")
|
||||||
@ -288,7 +286,7 @@ var _ = SIGDescribe("Advanced Audit", func() {
|
|||||||
}, {
|
}, {
|
||||||
Level: auditinternal.LevelRequest,
|
Level: auditinternal.LevelRequest,
|
||||||
Stage: auditinternal.StageResponseStarted,
|
Stage: auditinternal.StageResponseStarted,
|
||||||
RequestURI: fmt.Sprintf("/apis/apps/v1/namespaces/%s/deployments?timeoutSeconds=%d&watch=true", namespace, watchTestTimeout),
|
RequestURI: fmt.Sprintf("/apis/apps/v1/namespaces/%s/deployments?timeout=%ds&timeoutSeconds=%d&watch=true", namespace, watchTestTimeout, watchTestTimeout),
|
||||||
Verb: "watch",
|
Verb: "watch",
|
||||||
Code: 200,
|
Code: 200,
|
||||||
User: auditTestUser,
|
User: auditTestUser,
|
||||||
@ -300,7 +298,7 @@ var _ = SIGDescribe("Advanced Audit", func() {
|
|||||||
}, {
|
}, {
|
||||||
Level: auditinternal.LevelRequest,
|
Level: auditinternal.LevelRequest,
|
||||||
Stage: auditinternal.StageResponseComplete,
|
Stage: auditinternal.StageResponseComplete,
|
||||||
RequestURI: fmt.Sprintf("/apis/apps/v1/namespaces/%s/deployments?timeoutSeconds=%d&watch=true", namespace, watchTestTimeout),
|
RequestURI: fmt.Sprintf("/apis/apps/v1/namespaces/%s/deployments?timeout=%ds&timeoutSeconds=%d&watch=true", namespace, watchTestTimeout, watchTestTimeout),
|
||||||
Verb: "watch",
|
Verb: "watch",
|
||||||
Code: 200,
|
Code: 200,
|
||||||
User: auditTestUser,
|
User: auditTestUser,
|
||||||
@ -368,8 +366,7 @@ var _ = SIGDescribe("Advanced Audit", func() {
|
|||||||
|
|
||||||
configMapChan, err := f.ClientSet.CoreV1().ConfigMaps(namespace).Watch(watchOptions)
|
configMapChan, err := f.ClientSet.CoreV1().ConfigMaps(namespace).Watch(watchOptions)
|
||||||
framework.ExpectNoError(err, "failed to create watch for config maps")
|
framework.ExpectNoError(err, "failed to create watch for config maps")
|
||||||
for range configMapChan.ResultChan() {
|
configMapChan.Stop()
|
||||||
}
|
|
||||||
|
|
||||||
_, err = f.ClientSet.CoreV1().ConfigMaps(namespace).Update(configMap)
|
_, err = f.ClientSet.CoreV1().ConfigMaps(namespace).Update(configMap)
|
||||||
framework.ExpectNoError(err, "failed to update audit-configmap")
|
framework.ExpectNoError(err, "failed to update audit-configmap")
|
||||||
@ -423,7 +420,7 @@ var _ = SIGDescribe("Advanced Audit", func() {
|
|||||||
}, {
|
}, {
|
||||||
Level: auditinternal.LevelMetadata,
|
Level: auditinternal.LevelMetadata,
|
||||||
Stage: auditinternal.StageResponseStarted,
|
Stage: auditinternal.StageResponseStarted,
|
||||||
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/configmaps?timeoutSeconds=%d&watch=true", namespace, watchTestTimeout),
|
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/configmaps?timeout=%ds&timeoutSeconds=%d&watch=true", namespace, watchTestTimeout, watchTestTimeout),
|
||||||
Verb: "watch",
|
Verb: "watch",
|
||||||
Code: 200,
|
Code: 200,
|
||||||
User: auditTestUser,
|
User: auditTestUser,
|
||||||
@ -435,7 +432,7 @@ var _ = SIGDescribe("Advanced Audit", func() {
|
|||||||
}, {
|
}, {
|
||||||
Level: auditinternal.LevelMetadata,
|
Level: auditinternal.LevelMetadata,
|
||||||
Stage: auditinternal.StageResponseComplete,
|
Stage: auditinternal.StageResponseComplete,
|
||||||
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/configmaps?timeoutSeconds=%d&watch=true", namespace, watchTestTimeout),
|
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/configmaps?timeout=%ds&timeoutSeconds=%d&watch=true", namespace, watchTestTimeout, watchTestTimeout),
|
||||||
Verb: "watch",
|
Verb: "watch",
|
||||||
Code: 200,
|
Code: 200,
|
||||||
User: auditTestUser,
|
User: auditTestUser,
|
||||||
@ -502,8 +499,7 @@ var _ = SIGDescribe("Advanced Audit", func() {
|
|||||||
|
|
||||||
secretChan, err := f.ClientSet.CoreV1().Secrets(namespace).Watch(watchOptions)
|
secretChan, err := f.ClientSet.CoreV1().Secrets(namespace).Watch(watchOptions)
|
||||||
framework.ExpectNoError(err, "failed to create watch for secrets")
|
framework.ExpectNoError(err, "failed to create watch for secrets")
|
||||||
for range secretChan.ResultChan() {
|
secretChan.Stop()
|
||||||
}
|
|
||||||
|
|
||||||
_, err = f.ClientSet.CoreV1().Secrets(namespace).Update(secret)
|
_, err = f.ClientSet.CoreV1().Secrets(namespace).Update(secret)
|
||||||
framework.ExpectNoError(err, "failed to update audit-secret")
|
framework.ExpectNoError(err, "failed to update audit-secret")
|
||||||
@ -557,7 +553,7 @@ var _ = SIGDescribe("Advanced Audit", func() {
|
|||||||
}, {
|
}, {
|
||||||
Level: auditinternal.LevelMetadata,
|
Level: auditinternal.LevelMetadata,
|
||||||
Stage: auditinternal.StageResponseStarted,
|
Stage: auditinternal.StageResponseStarted,
|
||||||
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/secrets?timeoutSeconds=%d&watch=true", namespace, watchTestTimeout),
|
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/secrets?timeout=%ds&timeoutSeconds=%d&watch=true", namespace, watchTestTimeout, watchTestTimeout),
|
||||||
Verb: "watch",
|
Verb: "watch",
|
||||||
Code: 200,
|
Code: 200,
|
||||||
User: auditTestUser,
|
User: auditTestUser,
|
||||||
@ -569,7 +565,7 @@ var _ = SIGDescribe("Advanced Audit", func() {
|
|||||||
}, {
|
}, {
|
||||||
Level: auditinternal.LevelMetadata,
|
Level: auditinternal.LevelMetadata,
|
||||||
Stage: auditinternal.StageResponseComplete,
|
Stage: auditinternal.StageResponseComplete,
|
||||||
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/secrets?timeoutSeconds=%d&watch=true", namespace, watchTestTimeout),
|
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/secrets?timeout=%ds&timeoutSeconds=%d&watch=true", namespace, watchTestTimeout, watchTestTimeout),
|
||||||
Verb: "watch",
|
Verb: "watch",
|
||||||
Code: 200,
|
Code: 200,
|
||||||
User: auditTestUser,
|
User: auditTestUser,
|
||||||
|
@ -124,11 +124,7 @@ func testAudit(t *testing.T, version string) {
|
|||||||
|
|
||||||
configMapChan, err := kubeclient.CoreV1().ConfigMaps(namespace).Watch(watchOptions)
|
configMapChan, err := kubeclient.CoreV1().ConfigMaps(namespace).Watch(watchOptions)
|
||||||
expectNoError(t, err, "failed to create watch for config maps")
|
expectNoError(t, err, "failed to create watch for config maps")
|
||||||
for range configMapChan.ResultChan() {
|
configMapChan.Stop()
|
||||||
// Block until watchOptions.TimeoutSeconds expires.
|
|
||||||
// If the test finishes before watchOptions.TimeoutSeconds expires, the watch audit
|
|
||||||
// event at stage ResponseComplete will not be generated.
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = kubeclient.CoreV1().ConfigMaps(namespace).Update(configMap)
|
_, err = kubeclient.CoreV1().ConfigMaps(namespace).Update(configMap)
|
||||||
expectNoError(t, err, "failed to update audit-configmap")
|
expectNoError(t, err, "failed to update audit-configmap")
|
||||||
@ -183,7 +179,7 @@ func testAudit(t *testing.T, version string) {
|
|||||||
}, {
|
}, {
|
||||||
Level: auditinternal.LevelRequestResponse,
|
Level: auditinternal.LevelRequestResponse,
|
||||||
Stage: auditinternal.StageResponseStarted,
|
Stage: auditinternal.StageResponseStarted,
|
||||||
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/configmaps?timeoutSeconds=%d&watch=true", namespace, watchTestTimeout),
|
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/configmaps?timeout=%ds&timeoutSeconds=%d&watch=true", namespace, watchTestTimeout, watchTestTimeout),
|
||||||
Verb: "watch",
|
Verb: "watch",
|
||||||
Code: 200,
|
Code: 200,
|
||||||
User: auditTestUser,
|
User: auditTestUser,
|
||||||
@ -195,7 +191,7 @@ func testAudit(t *testing.T, version string) {
|
|||||||
}, {
|
}, {
|
||||||
Level: auditinternal.LevelRequestResponse,
|
Level: auditinternal.LevelRequestResponse,
|
||||||
Stage: auditinternal.StageResponseComplete,
|
Stage: auditinternal.StageResponseComplete,
|
||||||
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/configmaps?timeoutSeconds=%d&watch=true", namespace, watchTestTimeout),
|
RequestURI: fmt.Sprintf("/api/v1/namespaces/%s/configmaps?timeout=%ds&timeoutSeconds=%d&watch=true", namespace, watchTestTimeout, watchTestTimeout),
|
||||||
Verb: "watch",
|
Verb: "watch",
|
||||||
Code: 200,
|
Code: 200,
|
||||||
User: auditTestUser,
|
User: auditTestUser,
|
||||||
|
Loading…
Reference in New Issue
Block a user