func testBlock(t *testing.T, apiServer persist.APIServer) { jobInfo, err := apiServer.CreateJobInfo(context.Background(), &persist.JobInfo{}) require.NoError(t, err) jobID := jobInfo.JobId go func() { _, err := apiServer.CreateJobOutput( context.Background(), &persist.JobOutput{ JobId: jobID, OutputCommit: pfsutil.NewCommit("foo", "bar"), }) require.NoError(t, err) _, err = apiServer.CreateJobState( context.Background(), &persist.JobState{ JobId: jobID, State: pps.JobState_JOB_STATE_SUCCESS, }) require.NoError(t, err) }() _, err = apiServer.InspectJob( context.Background(), &pps.InspectJobRequest{ Job: &pps.Job{Id: jobID}, BlockOutput: true, BlockState: true, }, ) require.NoError(t, err) }
func testBasicRethink(t *testing.T, apiServer persist.APIServer) { jobInfo, err := apiServer.CreateJobInfo( context.Background(), &persist.JobInfo{ Spec: &persist.JobInfo_PipelineName{ PipelineName: "foo", }, }, ) require.NoError(t, err) getJobInfo, err := apiServer.GetJobInfo( context.Background(), &pps.Job{ Id: jobInfo.JobId, }, ) require.NoError(t, err) require.Equal(t, jobInfo.JobId, getJobInfo.JobId) require.Equal(t, "foo", getJobInfo.GetPipelineName()) }
func testBasicRethink(t *testing.T, apiServer persist.APIServer) { _, err := apiServer.CreatePipelineInfo( context.Background(), &persist.PipelineInfo{ PipelineName: "foo", }, ) require.NoError(t, err) pipelineInfo, err := apiServer.GetPipelineInfo( context.Background(), &pps.Pipeline{Name: "foo"}, ) require.NoError(t, err) require.Equal(t, pipelineInfo.PipelineName, "foo") inputCommits := []*pfs.Commit{pfsutil.NewCommit("bar", uuid.NewWithoutDashes())} jobInfo, err := apiServer.CreateJobInfo( context.Background(), &persist.JobInfo{ PipelineName: "foo", InputCommit: inputCommits, }, ) jobID := jobInfo.JobId inputCommits2 := []*pfs.Commit{pfsutil.NewCommit("fizz", uuid.NewWithoutDashes())} _, err = apiServer.CreateJobInfo( context.Background(), &persist.JobInfo{ PipelineName: "buzz", InputCommit: inputCommits2, }, ) require.NoError(t, err) jobInfo, err = apiServer.InspectJob( context.Background(), &pps.InspectJobRequest{ Job: &pps.Job{ Id: jobInfo.JobId, }, }, ) require.NoError(t, err) require.Equal(t, jobInfo.JobId, jobID) require.Equal(t, "foo", jobInfo.PipelineName) jobInfos, err := apiServer.ListJobInfos( context.Background(), &pps.ListJobRequest{ Pipeline: &pps.Pipeline{Name: "foo"}, }, ) require.NoError(t, err) require.Equal(t, len(jobInfos.JobInfo), 1) require.Equal(t, jobInfos.JobInfo[0].JobId, jobID) jobInfos, err = apiServer.ListJobInfos( context.Background(), &pps.ListJobRequest{ InputCommit: inputCommits, }, ) require.NoError(t, err) require.Equal(t, len(jobInfos.JobInfo), 1) require.Equal(t, jobInfos.JobInfo[0].JobId, jobID) jobInfos, err = apiServer.ListJobInfos( context.Background(), &pps.ListJobRequest{ Pipeline: &pps.Pipeline{Name: "foo"}, InputCommit: inputCommits, }, ) require.NoError(t, err) require.Equal(t, len(jobInfos.JobInfo), 1) require.Equal(t, jobInfos.JobInfo[0].JobId, jobID) }