mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 18:58:18 +00:00
Cleanup defer from SetFeatureGateDuringTest function call
This commit is contained in:
committed by
Marek Siarkowicz
parent
bf6507070c
commit
3ee8178768
@@ -36,19 +36,7 @@ if [[ -n "${direct_sets}" ]]; then
|
||||
echo "${direct_sets}" >&2
|
||||
echo >&2
|
||||
echo "Use this invocation instead:" >&2
|
||||
echo " defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.<FeatureName>, <value>)()" >&2
|
||||
echo >&2
|
||||
rc=1
|
||||
fi
|
||||
|
||||
# find test files calling SetFeatureGateDuringTest and not calling the result
|
||||
missing_defers=$(git grep "\\.SetFeatureGateDuringTest" -- '*_test.go' | grep -E -v "defer .*\\)\\(\\)$") || true
|
||||
if [[ -n "${missing_defers}" ]]; then
|
||||
echo "Invalid invocations of featuregatetesting.SetFeatureGateDuringTest():" >&2
|
||||
echo "${missing_defers}" >&2
|
||||
echo >&2
|
||||
echo "Always make a deferred call to the returned function to ensure the feature gate is reset:" >&2
|
||||
echo " defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.<FeatureName>, <value>)()" >&2
|
||||
echo " featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.<FeatureName>, <value>)" >&2
|
||||
echo >&2
|
||||
rc=1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user