dra e2e: fix stack unwinding in helper function
When failing inside the `ginkgo.By` callback function, skipping intermediate stack frames didn't work properly because `ginkgo.By` itself and other internal code is also on the stack. To fix this, the code which can fail now runs outside of such a callback. That's not a big loss, the only advantage of the callback was getting timing statistics from Ginkgo which weren't used in practice.
This commit is contained in:
		| @@ -1128,7 +1128,7 @@ func (b *builder) podExternalMultiple() *v1.Pod { | ||||
| func (b *builder) create(ctx context.Context, objs ...klog.KMetadata) []klog.KMetadata { | ||||
| 	var createdObjs []klog.KMetadata | ||||
| 	for _, obj := range objs { | ||||
| 		ginkgo.By(fmt.Sprintf("creating %T %s", obj, obj.GetName()), func() { | ||||
| 		ginkgo.By(fmt.Sprintf("creating %T %s", obj, obj.GetName())) | ||||
| 		var err error | ||||
| 		var createdObj klog.KMetadata | ||||
| 		switch obj := obj.(type) { | ||||
| @@ -1147,7 +1147,6 @@ func (b *builder) create(ctx context.Context, objs ...klog.KMetadata) []klog.KMe | ||||
| 		} | ||||
| 		framework.ExpectNoErrorWithOffset(1, err, "create %T", obj) | ||||
| 		createdObjs = append(createdObjs, createdObj) | ||||
| 		}) | ||||
| 	} | ||||
| 	return createdObjs | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Patrick Ohly
					Patrick Ohly