Merge pull request #89215 from k-toyoda-pi/use_expectnotequal_service

Use ExpectNotEqual in test/e2e/network/
This commit is contained in:
Kubernetes Prow Robot 2020-03-31 14:15:28 -07:00 committed by GitHub
commit 1b7f5662e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -46,6 +46,15 @@ do
fi
done
errors_expect_no_equal=()
for file in "${all_e2e_files[@]}"
do
if grep -E "Expect\(.*\)\.(NotTo|ToNot)\((gomega\.Equal|Equal)" "${file}" > /dev/null
then
errors_expect_no_equal+=( "${file}" )
fi
done
errors_expect_equal=()
for file in "${all_e2e_files[@]}"
do
@ -83,6 +92,20 @@ if [ ${#errors_expect_error[@]} -ne 0 ]; then
exit 1
fi
if [ ${#errors_expect_no_equal[@]} -ne 0 ]; then
{
echo "Errors:"
for err in "${errors_expect_no_equal[@]}"; do
echo "$err"
done
echo
echo 'The above files need to use framework.ExpectNotEqual(foo, bar) instead of '
echo 'Expect(foo).NotTo(Equal(bar)) or gomega.Expect(foo).NotTo(gomega.Equal(bar))'
echo
} >&2
exit 1
fi
if [ ${#errors_expect_equal[@]} -ne 0 ]; then
{
echo "Errors:"

View File

@ -940,7 +940,7 @@ var _ = SIGDescribe("Services", func() {
pausePods, err := cs.CoreV1().Pods(ns).List(context.TODO(), metav1.ListOptions{LabelSelector: labelSelector.String()})
framework.ExpectNoError(err, "Error in listing pods associated with pause pod deployments")
gomega.Expect(pausePods.Items[0].Spec.NodeName).ToNot(gomega.Equal(pausePods.Items[1].Spec.NodeName))
framework.ExpectNotEqual(pausePods.Items[0].Spec.NodeName, pausePods.Items[1].Spec.NodeName)
serviceAddress := net.JoinHostPort(serviceIP, strconv.Itoa(servicePort))