// TestIngestStoreWorkItems checks to see if Pharos WorkItems // were updated correctly. func TestIngestStoreWorkItems(t *testing.T) { if !apt_testutil.ShouldRunIntegrationTests() { t.Skip("Skipping integration test. Set ENV var RUN_EXCHANGE_INTEGRATION=true if you want to run them.") } _, workItems, err := dpn_testutil.GetDPNWorkItems() require.Nil(t, err) for _, item := range workItems { assert.Equal(t, constants.StageRecord, item.Stage) assert.Equal(t, constants.StatusPending, item.Status) assert.Equal(t, "Bag copied to long-term storage", item.Note) assert.Equal(t, "", item.Node) assert.Equal(t, 0, item.Pid) assert.True(t, item.Retry) } }
// TestIngestRecordWorkItems checks to see if Pharos WorkItems // were updated correctly. func TestIngestRecordWorkItems(t *testing.T) { if !apt_testutil.ShouldRunIntegrationTests() { t.Skip("Skipping integration test. Set ENV var RUN_EXCHANGE_INTEGRATION=true if you want to run them.") } _, workItems, err := dpn_testutil.GetDPNWorkItems() require.Nil(t, err) for _, item := range workItems { assert.Equal(t, constants.StageResolve, item.Stage) assert.Equal(t, constants.StatusSuccess, item.Status) assert.Equal(t, "DPN ingest complete", item.Note) assert.Equal(t, "", item.Node) assert.Equal(t, 0, item.Pid) assert.True(t, item.Retry) } }
// TestIngestRecordWorkItemState checks to see if Pharos WorkItemState // records were updated correctly. func TestIngestRecordWorkItemState(t *testing.T) { if !apt_testutil.ShouldRunIntegrationTests() { t.Skip("Skipping integration test. Set ENV var RUN_EXCHANGE_INTEGRATION=true if you want to run them.") } // This actually retrieves DPN related WorkItems, not DPNWorkItems. Hmm... _context, workItems, err := dpn_testutil.GetDPNWorkItems() require.Nil(t, err) for _, item := range workItems { require.NotNil(t, item.WorkItemStateId) resp := _context.PharosClient.WorkItemStateGet(*item.WorkItemStateId) require.Nil(t, resp.Error) workItemState := resp.WorkItemState() require.NotNil(t, workItemState) assert.Equal(t, constants.ActionDPN, workItemState.Action) assert.False(t, workItemState.CreatedAt.IsZero()) assert.False(t, workItemState.UpdatedAt.IsZero()) detail := fmt.Sprintf("%s from Pharos", item.ObjectIdentifier) testIngestRecordWorkItemState(t, _context, workItemState.State, detail) } }