(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestAttachmentNeedsInstanceStorageSetting(t *testing.T) { |
| 16 | tests := []struct { |
| 17 | name string |
| 18 | attachment *store.Attachment |
| 19 | want bool |
| 20 | }{ |
| 21 | { |
| 22 | name: "nil attachment", |
| 23 | }, |
| 24 | { |
| 25 | name: "local attachment", |
| 26 | attachment: &store.Attachment{ |
| 27 | StorageType: storepb.AttachmentStorageType_LOCAL, |
| 28 | }, |
| 29 | }, |
| 30 | { |
| 31 | name: "s3 attachment without payload", |
| 32 | attachment: &store.Attachment{ |
| 33 | StorageType: storepb.AttachmentStorageType_S3, |
| 34 | }, |
| 35 | }, |
| 36 | { |
| 37 | name: "s3 attachment with embedded config", |
| 38 | attachment: &store.Attachment{ |
| 39 | StorageType: storepb.AttachmentStorageType_S3, |
| 40 | Payload: &storepb.AttachmentPayload{ |
| 41 | Payload: &storepb.AttachmentPayload_S3Object_{ |
| 42 | S3Object: &storepb.AttachmentPayload_S3Object{ |
| 43 | S3Config: &storepb.StorageS3Config{}, |
| 44 | }, |
| 45 | }, |
| 46 | }, |
| 47 | }, |
| 48 | }, |
| 49 | { |
| 50 | name: "s3 attachment without embedded config", |
| 51 | attachment: &store.Attachment{ |
| 52 | StorageType: storepb.AttachmentStorageType_S3, |
| 53 | Payload: &storepb.AttachmentPayload{ |
| 54 | Payload: &storepb.AttachmentPayload_S3Object_{ |
| 55 | S3Object: &storepb.AttachmentPayload_S3Object{}, |
| 56 | }, |
| 57 | }, |
| 58 | }, |
| 59 | want: true, |
| 60 | }, |
| 61 | } |
| 62 | |
| 63 | for _, test := range tests { |
| 64 | t.Run(test.name, func(t *testing.T) { |
| 65 | if got := store.AttachmentNeedsInstanceStorageSetting(test.attachment); got != test.want { |
| 66 | t.Fatalf("AttachmentNeedsInstanceStorageSetting() = %v, want %v", got, test.want) |
| 67 | } |
| 68 | }) |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | func TestAttachmentStore(t *testing.T) { |
nothing calls this directly
no test coverage detected