MCPcopy
hub / github.com/flyteorg/flyte / TestDownloadFromStorage

Function TestDownloadFromStorage

flytecopilot/data/utils_test.go:97–115  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

95}
96
97func 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
117func init() {
118 labeled.SetMetricKeys("test")

Callers

nothing calls this directly

Calls 7

NewDataStoreFunction · 0.92
NewTestScopeFunction · 0.92
DataReferenceTypeAlias · 0.92
DownloadFileFromStorageFunction · 0.85
ErrorMethod · 0.65
WriteRawMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected