Add shortref and rename item_id (#4868)
<!-- PR description--> --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * #<issue> #### Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
83d9492b4f
commit
891814f15c
@ -44,7 +44,7 @@ func FromJSON(ctx context.Context, body []byte) (string, error) {
|
|||||||
return "", clues.Wrap(err, "converting to messageble")
|
return "", clues.Wrap(err, "converting to messageble")
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = clues.Add(ctx, "id", ptr.Val(data.GetId()))
|
ctx = clues.Add(ctx, "item_id", ptr.Val(data.GetId()))
|
||||||
|
|
||||||
email := mail.NewMSG()
|
email := mail.NewMSG()
|
||||||
email.AllowDuplicateAddress = true // More "correct" conversion
|
email.AllowDuplicateAddress = true // More "correct" conversion
|
||||||
|
|||||||
@ -44,7 +44,9 @@ func streamItems(
|
|||||||
errs := fault.New(false)
|
errs := fault.New(false)
|
||||||
|
|
||||||
for _, rc := range drc {
|
for _, rc := range drc {
|
||||||
for item := range rc.Items(ctx, errs) {
|
ictx := clues.Add(ctx, "path_short_ref", rc.FullPath().ShortRef())
|
||||||
|
|
||||||
|
for item := range rc.Items(ictx, errs) {
|
||||||
id := item.ID()
|
id := item.ID()
|
||||||
name := id + ".eml"
|
name := id + ".eml"
|
||||||
|
|
||||||
@ -64,7 +66,7 @@ func streamItems(
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
email, err := eml.FromJSON(ctx, content)
|
email, err := eml.FromJSON(ictx, content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ch <- export.Item{
|
ch <- export.Item{
|
||||||
ID: id,
|
ID: id,
|
||||||
|
|||||||
@ -33,6 +33,10 @@ func TestExportUnitSuite(t *testing.T) {
|
|||||||
func (suite *ExportUnitSuite) TestGetItems() {
|
func (suite *ExportUnitSuite) TestGetItems() {
|
||||||
emailBodyBytes := []byte(testdata.EmailWithAttachments)
|
emailBodyBytes := []byte(testdata.EmailWithAttachments)
|
||||||
|
|
||||||
|
pb := path.Builder{}.Append("Inbox")
|
||||||
|
p, err := pb.ToDataLayerPath("t", "r", path.ExchangeService, path.EmailCategory, false)
|
||||||
|
assert.NoError(suite.T(), err, "build path")
|
||||||
|
|
||||||
table := []struct {
|
table := []struct {
|
||||||
name string
|
name string
|
||||||
version int
|
version int
|
||||||
@ -44,6 +48,7 @@ func (suite *ExportUnitSuite) TestGetItems() {
|
|||||||
version: 1,
|
version: 1,
|
||||||
backingCollection: data.NoFetchRestoreCollection{
|
backingCollection: data.NoFetchRestoreCollection{
|
||||||
Collection: dataMock.Collection{
|
Collection: dataMock.Collection{
|
||||||
|
Path: p,
|
||||||
ItemData: []data.Item{
|
ItemData: []data.Item{
|
||||||
&dataMock.Item{
|
&dataMock.Item{
|
||||||
ItemID: "id1",
|
ItemID: "id1",
|
||||||
@ -65,6 +70,7 @@ func (suite *ExportUnitSuite) TestGetItems() {
|
|||||||
version: 1,
|
version: 1,
|
||||||
backingCollection: data.NoFetchRestoreCollection{
|
backingCollection: data.NoFetchRestoreCollection{
|
||||||
Collection: dataMock.Collection{
|
Collection: dataMock.Collection{
|
||||||
|
Path: p,
|
||||||
ItemData: []data.Item{
|
ItemData: []data.Item{
|
||||||
&dataMock.Item{
|
&dataMock.Item{
|
||||||
ItemID: "id1",
|
ItemID: "id1",
|
||||||
@ -95,6 +101,7 @@ func (suite *ExportUnitSuite) TestGetItems() {
|
|||||||
version: version.Groups9Update,
|
version: version.Groups9Update,
|
||||||
backingCollection: data.FetchRestoreCollection{
|
backingCollection: data.FetchRestoreCollection{
|
||||||
Collection: dataMock.Collection{
|
Collection: dataMock.Collection{
|
||||||
|
Path: p,
|
||||||
ItemData: []data.Item{
|
ItemData: []data.Item{
|
||||||
&dataMock.Item{
|
&dataMock.Item{
|
||||||
ItemID: "id0",
|
ItemID: "id0",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user