mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +00:00
Drop all stacktrace related validtion
The change is needed for `verify-e2e-test-ownership.sh`. The `jq` is re-defined since the structure of test spec is different with v1 and the stacktrace related validation is not available, e.g. `package` and `func`. Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
parent
20498fd65d
commit
2084f3cef2
@ -16,9 +16,7 @@
|
|||||||
|
|
||||||
# This script verifies the following e2e test ownership policies
|
# This script verifies the following e2e test ownership policies
|
||||||
# - tests MUST start with [sig-foo]
|
# - tests MUST start with [sig-foo]
|
||||||
# - tests MUST use top-level SIGDescribe
|
|
||||||
# - tests SHOULD NOT have multiple [sig-foo] tags
|
# - tests SHOULD NOT have multiple [sig-foo] tags
|
||||||
# - tests MUST NOT use nested SIGDescribe
|
|
||||||
# TODO: these two can be dropped if KubeDescribe is gone from codebase
|
# TODO: these two can be dropped if KubeDescribe is gone from codebase
|
||||||
# - tests MUST NOT have [k8s.io] in test names
|
# - tests MUST NOT have [k8s.io] in test names
|
||||||
# - tests MUST NOT use KubeDescribe
|
# - tests MUST NOT use KubeDescribe
|
||||||
@ -73,21 +71,24 @@ function ensure_dependencies() {
|
|||||||
function generate_results_json() {
|
function generate_results_json() {
|
||||||
readonly results_jq=${tmpdir}/results.jq
|
readonly results_jq=${tmpdir}/results.jq
|
||||||
cat >"${results_jq}" <<EOS
|
cat >"${results_jq}" <<EOS
|
||||||
[.[] | . as { ComponentTexts: \$text, ComponentCodeLocations: \$code } | {
|
[.[] | select( .LeafNodeType == "It") | . as { ContainerHierarchyTexts: \$text, ContainerHierarchyLocations: \$code, LeafNodeText: \$leafText, LeafNodeLocation: \$leafCode} | {
|
||||||
calls: [ \$text | range(1;length) as \$i | {
|
calls: ([ \$text | range(0;length) as \$i | {
|
||||||
sig: ((\$text[\$i] | match("\\\[(sig-[^\\\]]+)\\\]") | .captures[0].string) // "unknown"),
|
sig: ((\$text[\$i] | match("\\\[(sig-[^\\\]]+)\\\]") | .captures[0].string) // "unknown"),
|
||||||
text: \$text[\$i],
|
text: \$text[\$i],
|
||||||
# unused, but if we ever wanted to have policies based on other tags...
|
# unused, but if we ever wanted to have policies based on other tags...
|
||||||
# tags: \$text[\$i] | [match("(\\\[[^\\\]]+\\\])"; "g").string],
|
# tags: \$text[\$i] | [match("(\\\[[^\\\]]+\\\])"; "g").string],
|
||||||
line: \$code[\$i] | "\(.FileName):\(.LineNumber)",
|
line: \$code[\$i] | "\(.FileName):\(.LineNumber)"
|
||||||
} + (\$code[\$i] | .FullStackTrace | match("^(.*)\\\.(.+)\\\(.*\\n") | .captures | {
|
}] + [{
|
||||||
package: .[0].string,
|
sig: ((\$leafText | match("\\\[(sig-[^\\\]]+)\\\]") | .captures[0].string) // "unknown"),
|
||||||
func: .[1].string
|
text: \$leafText,
|
||||||
})],
|
# unused, but if we ever wanted to have policies based on other tags...
|
||||||
|
# tags: \$leafText | [match("(\\\[[^\\\]]+\\\])"; "g").string],
|
||||||
|
line: \$leafCode | "\(.FileName):\(.LineNumber)"
|
||||||
|
}]),
|
||||||
} | {
|
} | {
|
||||||
owner: .calls[0].sig,
|
owner: .calls[0].sig,
|
||||||
|
calls: .calls,
|
||||||
testname: .calls | map(.text) | join(" "),
|
testname: .calls | map(.text) | join(" "),
|
||||||
calls,
|
|
||||||
policies: [(
|
policies: [(
|
||||||
.calls[0] |
|
.calls[0] |
|
||||||
{
|
{
|
||||||
@ -96,12 +97,6 @@ function generate_results_json() {
|
|||||||
category: "unowned_test",
|
category: "unowned_test",
|
||||||
reason: "must start with [sig-foo]",
|
reason: "must start with [sig-foo]",
|
||||||
found: .,
|
found: .,
|
||||||
}, {
|
|
||||||
fail: (.func != "SIGDescribe"),
|
|
||||||
level: "FAIL",
|
|
||||||
category: "no_sig_describe",
|
|
||||||
reason: "must use top-level SIGDescribe",
|
|
||||||
found: .,
|
|
||||||
}
|
}
|
||||||
), (
|
), (
|
||||||
.calls[1:] |
|
.calls[1:] |
|
||||||
@ -111,13 +106,6 @@ function generate_results_json() {
|
|||||||
category: "too_many_sigs",
|
category: "too_many_sigs",
|
||||||
reason: "should not have multiple [sig-foo] tags",
|
reason: "should not have multiple [sig-foo] tags",
|
||||||
found: .,
|
found: .,
|
||||||
}),
|
|
||||||
(map(select(.func == "SIGDescribe")) // [] | {
|
|
||||||
fail: . | any,
|
|
||||||
level: "FAIL",
|
|
||||||
category: "nested_sig_describe",
|
|
||||||
reason: "must not use nested SIGDescribe",
|
|
||||||
found: .,
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user