(t *testing.T)
| 95 | } |
| 96 | |
| 97 | func TestDownloadFromStorage(t *testing.T) { |
| 98 | store, err := storage.NewDataStore(&storage.Config{Type: storage.TypeMemory}, promutils.NewTestScope()) |
| 99 | assert.NoError(t, err) |
| 100 | ref := storage.DataReference("ref") |
| 101 | |
| 102 | f, err := DownloadFileFromStorage(context.TODO(), ref, store) |
| 103 | assert.Error(t, err) |
| 104 | assert.Nil(t, f) |
| 105 | |
| 106 | data := []byte("data") |
| 107 | l := int64(len(data)) |
| 108 | |
| 109 | assert.NoError(t, store.WriteRaw(context.TODO(), ref, l, storage.Options{}, bytes.NewReader(data))) |
| 110 | f, err = DownloadFileFromStorage(context.TODO(), ref, store) |
| 111 | if assert.NoError(t, err) { |
| 112 | assert.NotNil(t, f) |
| 113 | f.Close() |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | func init() { |
| 118 | labeled.SetMetricKeys("test") |
nothing calls this directly
no test coverage detected