einride / protoc-gen-go-aip-test

MIT License
8 stars 0 forks source link

fix(get/soft-deleted): support delete methods which returns Empty #253

Closed thall closed 2 months ago

thall commented 2 months ago

Current implementation generates a test case that fails because the deleted response and the get response have different types.

Failing test:

[backend:go-test]     --- FAIL: TestAIP/Trip (4.26s)
[backend:go-test]         --- FAIL: TestAIP/Trip/Get (0.53s)
[backend:go-test]             --- FAIL: TestAIP/Trip/Get/soft-deleted (0.24s)
[backend:go-test]                 deliver_service_aiptest.pb.go:1557: assertion failed: 
[backend:go-test]                     --- msg
[backend:go-test]                     +++ deleted
[backend:go-test]                       any(Inverse(protocmp.Transform, protocmp.Message{
[backend:go-test]                     -     "@type":                s"einride.deliver.v1.Trip", <<--------
[backend:go-test]                     +     "@type":                s"google.protobuf.Empty", <<--------
[backend:go-test]                     -     "create_time":          s"2024-08-05T08:26:07.821887Z",
[backend:go-test]                     -     "creator_organization": string("organizations/org1"),
[backend:go-test]                     -     "delete_time":          s"2024-08-05T08:26:07.844764Z",
[backend:go-test]                     -     "deleted":              bool(true),
[backend:go-test]                     -     "display_name":         string("my dispatch"),
[backend:go-test]                     -     "etag":                 string(`"d37u2f3br1wg"`),
[backend:go-test]                     -     "name":                 string("spaces/1/trips/jzz7wghyerb3bbmhvrsmqhlo5a"),
[backend:go-test]                     -     "space":                string("spaces/1"),
[backend:go-test]                     -     "tasks": []protocmp.Message{
[backend:go-test]                     -         s`{id:"dh5tvq3qr5eq7ohgkkoxsvbkq4", state:ACTIVE, pickup:{shipment:"spaces/1/shipments/dlwpaauukzhjnclinu2ta7gwcq", stop_id:"1", s`...,
[backend:go-test]                     -         s`{id:"axex6ibv7vegtapvzhbboppy34", state:ACTIVE, deliver:{shipment:"spaces/1/shipments/dlwpaauukzhjnclinu2ta7gwcq", stop_id:"2", `...,
[backend:go-test]                     -     },
[backend:go-test]                     -     "update_time":        s"2024-08-05T08:26:07.844764Z",
[backend:go-test]                     -     "user":               string("users/user1"),
[backend:go-test]                     -     "vehicle_deployment": string("spaces/space/vehicleDeployments/vehicleDeployment"),
[backend:go-test]                       }))
[backend:go-test]                     

Add logic for supporting both.

TRA-1618