Esempio n. 1
0
// setWorkSpec calls the eponymous JobServer function, checking that
// it ran successfully, and returns the work spec name on success.
func setWorkSpec(t *testing.T, j *jobserver.JobServer, workSpec map[string]interface{}) string {
	ok, msg, err := j.SetWorkSpec(workSpec)
	if assert.NoError(t, err) {
		assert.True(t, ok)
		assert.Empty(t, msg)
	}

	workSpecName, ok := workSpec["name"].(string)
	assert.True(t, ok, "workSpec[\"name\"] not a string")
	return workSpecName
}