mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Fix the nil pointer dereference for comformance spec validation
`verify-conformance-yaml.sh` is used to verify the test spec of conformance e2e test are valid. Bascically, it calls `e2e.test` binary to dump the test spec and then walk the source to generate the `conformance.yaml`. If the `e2e.test` binary is outdated, it's possible that `testInfo` is nil. Access the field from nil will result to `nil pointer dereference` Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
parent
ba1bbb5ac6
commit
1b5d8b0b9b
@ -108,13 +108,12 @@ func main() {
|
|||||||
testInfo := getTestInfo(spec)
|
testInfo := getTestInfo(spec)
|
||||||
if testInfo != nil {
|
if testInfo != nil {
|
||||||
testInfos = append(testInfos, testInfo)
|
testInfos = append(testInfos, testInfo)
|
||||||
}
|
|
||||||
|
|
||||||
if err := validateTestName(testInfo.CodeName); err != nil {
|
if err := validateTestName(testInfo.CodeName); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sort.Slice(testInfos, func(i, j int) bool { return testInfos[i].CodeName < testInfos[j].CodeName })
|
sort.Slice(testInfos, func(i, j int) bool { return testInfos[i].CodeName < testInfos[j].CodeName })
|
||||||
saveAllTestInfo(testInfos)
|
saveAllTestInfo(testInfos)
|
||||||
|
Loading…
Reference in New Issue
Block a user