(t *testing.T)
| 106 | } |
| 107 | |
| 108 | func TestObjectConfigAttributes(t *testing.T) { |
| 109 | tests := []struct { |
| 110 | name string |
| 111 | cacheControl string |
| 112 | metadata map[string]string |
| 113 | expectedObject raw.Object |
| 114 | }{ |
| 115 | { |
| 116 | name: "cache controle enabled", |
| 117 | cacheControl: "no-cache", |
| 118 | expectedObject: raw.Object{Name: "test/object", Bucket: "blerg2", CacheControl: "no-cache"}, |
| 119 | }, |
| 120 | { |
| 121 | name: "medata set", |
| 122 | metadata: map[string]string{"one": "1"}, |
| 123 | expectedObject: raw.Object{Name: "test/object", Bucket: "blerg2", Metadata: map[string]string{"one": "1"}}, |
| 124 | }, |
| 125 | } |
| 126 | |
| 127 | for _, tc := range tests { |
| 128 | t.Run(tc.name, func(t *testing.T) { |
| 129 | rawObject := raw.Object{} |
| 130 | server := fakeServerWithObjectAttributes(t, &rawObject) |
| 131 | |
| 132 | _, w, _, err := New(&Config{ |
| 133 | BucketName: "blerg2", |
| 134 | Endpoint: server.URL, |
| 135 | Insecure: true, |
| 136 | ObjectCacheControl: tc.cacheControl, |
| 137 | ObjectMetadata: tc.metadata, |
| 138 | }) |
| 139 | require.NoError(t, err) |
| 140 | |
| 141 | ctx := context.Background() |
| 142 | |
| 143 | _ = w.Write(ctx, "object", []string{"test"}, bytes.NewReader([]byte{}), 0, nil) |
| 144 | assert.Equal(t, tc.expectedObject, rawObject) |
| 145 | }) |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | func TestRetry_MarkBlockCompacted(t *testing.T) { |
| 150 | var reqCounts sync.Map |
nothing calls this directly
no test coverage detected