mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #88930 from oomichi/Failf
Replace ExpectNoError(fmt.Errorf(..)) with funcs
This commit is contained in:
commit
b88ea8d2bb
@ -157,9 +157,7 @@ func TestReplicationControllerServeImageOrFail(f *framework.Framework, test stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
if running != replicas {
|
framework.ExpectEqual(running, replicas, "unexpected number of running pods: %+v", pods.Items)
|
||||||
framework.ExpectNoError(fmt.Errorf("unexpected number of running pods: %+v", pods.Items))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify that something is listening.
|
// Verify that something is listening.
|
||||||
framework.Logf("Trying to dial the pod")
|
framework.Logf("Trying to dial the pod")
|
||||||
|
@ -159,9 +159,7 @@ func testReplicaSetServeImageOrFail(f *framework.Framework, test string, image s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
if running != replicas {
|
framework.ExpectEqual(running, replicas, "unexpected number of running pods: %+v", pods.Items)
|
||||||
framework.ExpectNoError(fmt.Errorf("unexpected number of running pods: %+v", pods.Items))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify that something is listening.
|
// Verify that something is listening.
|
||||||
framework.Logf("Trying to dial the pod")
|
framework.Logf("Trying to dial the pod")
|
||||||
|
@ -182,9 +182,7 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
|
|||||||
}
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
})
|
})
|
||||||
if pollErr != nil {
|
framework.ExpectNoError(pollErr, "timed out waiting for ingress %s to get %s annotation", name, instanceGroupAnnotation)
|
||||||
framework.ExpectNoError(fmt.Errorf("timed out waiting for ingress %s to get %s annotation", name, instanceGroupAnnotation))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify that the ingress does not get other annotations like url-map, target-proxy, backends, etc.
|
// Verify that the ingress does not get other annotations like url-map, target-proxy, backends, etc.
|
||||||
// Note: All resources except the firewall rule have an annotation.
|
// Note: All resources except the firewall rule have an annotation.
|
||||||
|
@ -141,9 +141,8 @@ var _ = SIGDescribe("NoSNAT [Feature:NoSNAT] [Slow]", func() {
|
|||||||
ginkgo.By("creating a test pod on each Node")
|
ginkgo.By("creating a test pod on each Node")
|
||||||
nodes, err := nc.List(context.TODO(), metav1.ListOptions{})
|
nodes, err := nc.List(context.TODO(), metav1.ListOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
if len(nodes.Items) == 0 {
|
framework.ExpectNotEqual(len(nodes.Items), 0, "no Nodes in the cluster")
|
||||||
framework.ExpectNoError(fmt.Errorf("no Nodes in the cluster"))
|
|
||||||
}
|
|
||||||
for _, node := range nodes.Items {
|
for _, node := range nodes.Items {
|
||||||
// find the Node's internal ip address to feed to the Pod
|
// find the Node's internal ip address to feed to the Pod
|
||||||
inIP, err := getIP(v1.NodeInternalIP, &node)
|
inIP, err := getIP(v1.NodeInternalIP, &node)
|
||||||
|
@ -79,9 +79,7 @@ func (t *DeploymentUpgradeTest) Setup(f *framework.Framework) {
|
|||||||
rsList, err := rsClient.List(context.TODO(), metav1.ListOptions{LabelSelector: rsSelector.String()})
|
rsList, err := rsClient.List(context.TODO(), metav1.ListOptions{LabelSelector: rsSelector.String()})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
rss := rsList.Items
|
rss := rsList.Items
|
||||||
if len(rss) != 1 {
|
framework.ExpectEqual(len(rss), 1, "expected one replicaset, got %d", len(rss))
|
||||||
framework.ExpectNoError(fmt.Errorf("expected one replicaset, got %d", len(rss)))
|
|
||||||
}
|
|
||||||
t.oldRSUID = rss[0].UID
|
t.oldRSUID = rss[0].UID
|
||||||
|
|
||||||
ginkgo.By(fmt.Sprintf("Waiting for revision of the deployment %q to become 1", deploymentName))
|
ginkgo.By(fmt.Sprintf("Waiting for revision of the deployment %q to become 1", deploymentName))
|
||||||
@ -101,9 +99,7 @@ func (t *DeploymentUpgradeTest) Setup(f *framework.Framework) {
|
|||||||
rsList, err = rsClient.List(context.TODO(), metav1.ListOptions{LabelSelector: rsSelector.String()})
|
rsList, err = rsClient.List(context.TODO(), metav1.ListOptions{LabelSelector: rsSelector.String()})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
rss = rsList.Items
|
rss = rsList.Items
|
||||||
if len(rss) != 2 {
|
framework.ExpectEqual(len(rss), 2, "expected 2 replicaset, got %d", len(rss))
|
||||||
framework.ExpectNoError(fmt.Errorf("expected 2 replicaset, got %d", len(rss)))
|
|
||||||
}
|
|
||||||
|
|
||||||
ginkgo.By(fmt.Sprintf("Checking replicaset of deployment %q that is created before rollout survives the rollout", deploymentName))
|
ginkgo.By(fmt.Sprintf("Checking replicaset of deployment %q that is created before rollout survives the rollout", deploymentName))
|
||||||
switch t.oldRSUID {
|
switch t.oldRSUID {
|
||||||
@ -144,9 +140,7 @@ func (t *DeploymentUpgradeTest) Test(f *framework.Framework, done <-chan struct{
|
|||||||
rsList, err := rsClient.List(context.TODO(), metav1.ListOptions{LabelSelector: rsSelector.String()})
|
rsList, err := rsClient.List(context.TODO(), metav1.ListOptions{LabelSelector: rsSelector.String()})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
rss := rsList.Items
|
rss := rsList.Items
|
||||||
if len(rss) != 2 {
|
framework.ExpectEqual(len(rss), 2, "expected 2 replicaset, got %d", len(rss))
|
||||||
framework.ExpectNoError(fmt.Errorf("expected 2 replicaset, got %d", len(rss)))
|
|
||||||
}
|
|
||||||
|
|
||||||
switch t.oldRSUID {
|
switch t.oldRSUID {
|
||||||
case rss[0].UID:
|
case rss[0].UID:
|
||||||
|
Loading…
Reference in New Issue
Block a user