Capture more error locations during stress tests
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
f12ba2407e
commit
e68bdbe9d9
@ -84,13 +84,16 @@ func (w *execWorker) exec(ctx, tctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
func (w *execWorker) runExec(ctx context.Context, task containerd.Task, id string, spec *specs.Process) error {
|
||||
func (w *execWorker) runExec(ctx context.Context, task containerd.Task, id string, spec *specs.Process) (err error) {
|
||||
process, err := task.Exec(ctx, id, spec, cio.NullIO)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer process.Delete(ctx, containerd.WithProcessKill)
|
||||
|
||||
defer func() {
|
||||
if _, derr := process.Delete(ctx, containerd.WithProcessKill); err == nil {
|
||||
err = derr
|
||||
}
|
||||
}()
|
||||
statusC, err := process.Wait(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -105,6 +108,7 @@ func (w *execWorker) runExec(ctx context.Context, task containerd.Task, id strin
|
||||
return nil
|
||||
}
|
||||
w.failures++
|
||||
errCounter.WithValues(err.Error()).Inc()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ func (w *worker) run(ctx, tctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
func (w *worker) runContainer(ctx context.Context, id string) error {
|
||||
func (w *worker) runContainer(ctx context.Context, id string) (err error) {
|
||||
// fix up cgroups path for a default config
|
||||
w.spec.Linux.CgroupsPath = filepath.Join("/", "stress", id)
|
||||
c, err := w.client.NewContainer(ctx, id,
|
||||
@ -68,14 +68,20 @@ func (w *worker) runContainer(ctx context.Context, id string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer c.Delete(ctx, containerd.WithSnapshotCleanup)
|
||||
|
||||
defer func() {
|
||||
if derr := c.Delete(ctx, containerd.WithSnapshotCleanup); err == nil {
|
||||
err = derr
|
||||
}
|
||||
}()
|
||||
task, err := c.NewTask(ctx, cio.NullIO)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer task.Delete(ctx, containerd.WithProcessKill)
|
||||
|
||||
defer func() {
|
||||
if _, derr := task.Delete(ctx, containerd.WithProcessKill); err == nil {
|
||||
err = derr
|
||||
}
|
||||
}()
|
||||
statusC, err := task.Wait(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -90,6 +96,7 @@ func (w *worker) runContainer(ctx context.Context, id string) error {
|
||||
return nil
|
||||
}
|
||||
w.failures++
|
||||
errCounter.WithValues(err.Error()).Inc()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user