// delWorkUnitsBy is the core of the DelWorkUnits tests that expect to // delet single work units. It calls options(state) to get options // to DelWorkUnits, and verifies that this deletes the single work unit // associated with state. func delWorkUnitsBy(t *testing.T, j *jobserver.JobServer, n int, state jobserver.WorkUnitStatus, options func(jobserver.WorkUnitStatus) map[string]interface{}) { workSpecName, expected := prepareSomeOfEach(t, j, n) delete(expected, stateShortName[state]) count, msg, err := j.DelWorkUnits(workSpecName, options(state)) if assert.NoError(t, err) { assert.Equal(t, 1, count) assert.Empty(t, msg) } listWorkUnits(t, j, workSpecName, gwuEverything, expected) _, err = j.Clear() assert.NoError(t, err) }